[Haskell-cafe] StdGen Reliability Across Versions / Systems

Paolo Giarrusso p.giarrusso at gmail.com
Wed Aug 31 20:39:32 UTC 2016


On Saturday, August 27, 2016 at 7:13:28 AM UTC+2, Christopher Howard wrote:
>
> I know that, ff you feed mkStdGen a particular seed, and pull a list of
> random numbers from that StdGen, that that the list will always be the
> same if your run your compiled program over and over again on that same
> system. But which of the following will cause you to get different output?:
>
> 2) Changes in "random" library version
>

Here's my semi-informed two cents:

In principle yes if they change random-generation algorithm.

1) Changes in GHC version
>

3) Compiling / Running on a different host computer (but compiling with
> the same GHC & random versions.
>
 
IIUC no: the actual random number generator is not only a fully 
deterministic algorithm, but is written using simple integer arithmetic 
(not even bitwise operations) which should always have the same semantics 
(my only doubt is about the size of `Int`).
OTOH generating random floating-point numbers does more hackery which would 
require a closer inspection.

Reference: stdNext and stdSplit in 
http://hackage.haskell.org/package/random-1.1/docs/src/System-Random.html#StdGen

For further details and better reassurances, you might have better luck 
asking the authors (on GitHub). Maybe this could be documented?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160831/9887d9ee/attachment.html>


More information about the Haskell-Cafe mailing list