Hello Christopher, unfortunately this is not a "better StdGen", because it still uses the poor PRNG algorithm of StdGen. You can get better statistic properties by using a package like mwc-random or mersenne-random.
However, if you want (an approximation of) truely random numbers, you need to read from /dev/random. If you prefer pseudo-random numbers, but need cryptographic strength, you can use the "OpenSSL.Random" module from the HsOpenSSL package. Greets, Ertugrul Christopher Done <[email protected]> wrote: > I've used this one before: > > betterStdGen :: IO StdGen > betterStdGen = alloca $ \p -> do > h <- openBinaryFile "/dev/random" ReadMode > hGetBuf h p $ sizeOf (undefined :: Int) > hClose h > mkStdGen <$> peek p -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://blog.ertes.de/ _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
