[Haskell-beginners] randmomR produces only even values

Chaddaï Fouché chaddai.fouche at gmail.com
Sun Nov 1 21:42:12 UTC 2015


I really don't think this is much of a flaw. It may need to be reinforced
that this package (and most random libraries) doesn't provide _any_
guarantee if you use it like that (restrain the first output with randomR
of lots of random generators initialized by very particular seeds sequence).

The guarantee the paper will be talking about will be for a sequence of
random numbers generated by one generator and this behave normally as shown
by :

> (minimum &&& maximum) . map (length . filter even . take 1000 . randomRs
(1,10) . mkStdGen) $ [1..1000]
(432,553)

In other words, if there's any problem it is only one of documentation
(just a warning in the haddock ought to be sufficient).
-- 
Jedaï
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151101/0435bbe7/attachment.html>


More information about the Beginners mailing list