
On 12/30/2011 04:38 PM, Jerzy Karczmarczuk wrote:
Bardur Arantsson:
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.
Sure. But the discussion on randomness is /per se/ interesting, especially in a functional setting.
Anyway, nobody can convince Steve Horne. Perhaps as an "unintentional" side-effect...
But random streams, or rather pseudo-random streals (infinite lazy lists, as the example I gave, the `iterate` of `next`) are as referentially transparent as any Haskell data. Really.
Of course -- if you just have a starting seed and the rest of the sequence is known from there. I was thinking of e.g. those "periodic re-initialization" ways of doing RNG.
I *NEVER* used "true" random numbers, even to initialize a generator, since in the simulation business it is essential that you can repeat the sequence on some other platform, with some other parameters, etc.
I've heard this a lot from physicists -- of course if you run a simulation reproducibility can be extremely important (e.g. for double-checking computations across different machines). However, if you're doing crypto it may not be so desirable :). Anyway, I'm out of this thread too :). Cheers,