On Mon, Oct 12, 2009 at 12:25 AM, Michael Mossey <[email protected]>wrote:

> I'm trying to learn how to use randomness in Haskell and it seems very
> non-straightforward and complex. I could do a lot of things using 'split'
> from System.Random, but apparently it's broken. There is the statistics
> package here:
>
> http://hackage.haskell.org/package/statistics
>
> Is this a better solution?
>

Yes, as it's much faster, more robust, and (depending on your perspective)
easier to use, provided you understand the ST monad.


> It uses the ST monad in the RandomVariate module. Can someone point me to a
> tutorial explaining ST, and/or a tutorial in the RandomVariate module?
>

For a tutorial on grokking ST, I'd suggest chapter 26 of Real World Haskell,
but I'm biased, since I wrote it:

http://book.realworldhaskell.org/read/advanced-library-design-building-a-bloom-filter.html

Note that this already assumes that you understand monads pretty well.

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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to