[Haskell-cafe] StdGen Reliability Across Versions / Systems

Ken Bateman novadenizen at gmail.com
Thu Sep 1 23:06:37 UTC 2016


Changes to the instance Random for Int and other basic types have recently
occurred without modifying anything about StdGen.  I successfully submitted
a patch a while back that had that effect.

On Aug 31, 2016 4:49 PM, "Paolo Giarrusso" <p.giarrusso at gmail.com> wrote:

> 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?
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160901/fad8292b/attachment.html>


More information about the Haskell-Cafe mailing list