
12 Oct
2009
12 Oct
'09
2:05 p.m.
On Mon, Oct 12, 2009 at 11:01 AM, Bryan O'Sullivan
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.