Skip to content

newStdGen returns the same value on successive calls

It seems newStdGen only depends on the second, it should have better resolution and/or use /dev/random.

Test program:

   import Random
   main = newStdGen >>= print

compiled with ghc 6.6 or 6.7 (at some point in time) Running "date; ./random" gives:

Thu Apr 12 10:51:54 CEST 2007
1938403181 6764
Thu Apr 12 10:51:54 CEST 2007
1938403181 6764
Thu Apr 12 10:51:55 CEST 2007
529729936 6762
Thu Apr 12 10:51:55 CEST 2007
529729936 6762
Thu Apr 12 10:51:56 CEST 2007
1023702766 6762
Thu Apr 12 10:51:56 CEST 2007
1023702766 6762
Thu Apr 12 10:52:03 CEST 2007
186545450 6762
Thu Apr 12 10:52:04 CEST 2007
680518280 6762
Thu Apr 12 10:52:04 CEST 2007
680518280 6762
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information