
On 12/29/2011 09:39 PM, Jerzy Karczmarczuk wrote:
"Truly random" numbers are very rarely used, forget about them.
Well, obviously, but why should we forget about them? The usual approach(*) is to gather entropy from a truly(**) random source and use that to seed (and perhaps periodically re-seed) a PRNG. (*) At least as far as I understand it. (**) At least one believed to be truly random. My point was simply to make clear the distinction between RNG vs. PRNG.
"Standard" r. generators (pseudo-random) in Haskell are monadic, because the relevant algorithms are stateful. Congruential, Fibonacci, Mersenne Twister, whatever, is a function, more or less: (newValue,newSeed) = rgen seed
The monadic approach serves mainly to hide the seed. Some people prefer to use random streams, no monads, so the question of Steve Horne is not universal.
Random streams are not referentially transparent, though, AFAICT...? Either way this thread has gone on long enough, let's not prolong it needlessly with this side discussion.