On Mon, Oct 12, 2009 at 11:01 AM, Bryan O'Sullivan <[email protected]>wrote:

>
> Pseudorandomness seems like one case where it would just be a hell of a lot
>> simpler to have a global generator--never split the state. Is the ST monad
>> some way to accomplish this?
>
>
> Having [...]
>

Feh, gmail fail.

Having a global generator is not actually a good thing, since it has to live
*somewhere*. If you keep its existence implicit, it becomes slow, since you
have to lock it against concurrent use by multiple threads. If you make it
explicit, you have to plumb the thing all over the place by hand, which is
also nasty. The advantage of putting the PRNG in the ST monad is that you
can seed a new PRNG close to the point where you'll need it, and not need to
pass around so much state.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to