
Michael P Mossey wrote:
I have an application for random numbers. So far, in my journey with Haskell, I have learned basics and a few things about monads, and I was hoping I could get some guidance how to employ random # gens.
Can I get a few examples or pointers? I believe I will have to run this in a State monad or the IO monad, will I not?
Yes, the State StdGen monad for example. Note however that it's best to keep it abstract, i.e. to hide the fact that it happens to be a state monad. See also http://lukepalmer.wordpress.com/2009/01/17/use-monadrandom/ for making the case, http://en.wikibooks.org/wiki/Haskell/Understanding_monads for detailing the random number monad, and http://apfelmus.nfshost.com/random-permutations.html for an example use. Regards, apfelmus -- http://apfelmus.nfshost.com