[Haskell-beginners] To use random number monad inside function
gtener at gmail.com
Tue Jan 27 22:57:41 EST 2009
You need to store random generator seed somewhere and keep track of updated
value after calling randomness-related functions.You can try doing it
manually, but what really fits here is monad that keeps track of that seed
value. Good news is: there is already package with such monad on Hackage. In
particular, try package MonadRandom (
If you have cabal-install, you can simply get it with "cabal install
monadrandom" (and if you don't have cabal-install, you should get this
wonderful tool right now!).
There are some examples within the documentation here:
On Wed, Jan 28, 2009 at 04:33, Erick González <erickgc at instec.cu> wrote:
> Haskell' s way of random number generation is strange to me, but I know how
> to do that. I' d like to know how can I call random numbers generated on the
> screen inside a classic function. I mean, I need to know the way of calling
> random numbers (one different every time that I run) inside a function.
> Please, Could anybody help me?
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners