[Haskell-cafe] On the purity of Haskell
Steve Horne
sh006d3592 at blueyonder.co.uk
Thu Dec 29 21:20:48 CET 2011
On 29/12/2011 19:55, Bardur Arantsson wrote:
> On 12/29/2011 08:47 PM, Steve Horne wrote:
>> On 29/12/2011 19:21, Heinrich Apfelmus wrote:
>>>
>> BTW - why use an IO action for random number generation? There's a
>> perfectly good pure generator. It's probably handy to treat it
>> monadically to sequence the generator state/seed/whatever but random
>> number generation can be completely pure.
>
> *Pseudo* random number generation can of course be pure (though
> threading the state would be tedious and error-prone). If you want
> truly random numbers you cannot avoid IO (the monad).
On the threading the state thing - it doesn't matter whether it's the IO
monad or the State monad (a perfect wrapper for the seed).
For where-does-the-entropy-come-from, though, yes - I guess you're right.
More information about the Haskell-Cafe
mailing list