[Haskell-cafe] Mersenne-random and standard random API

Aleksey Khudyakov alexey.skladnoy at gmail.com
Thu Feb 9 11:59:22 CET 2012

On 09.02.2012 01:56, Yves Parès wrote:
> Hi,
> I've been in the past told that mersenne-random was much better than the
> standard random package.
> So is it possible to use the fast and efficient mersenne generator with
> the convenient and general random API?
I think design of Random type class basically precludes efficient 
generators with large periods and consequently large state.
Look at next function:

 > next :: g -> (Int, g)

It means that state has to be copied but for efficiency we want to
mutate it in place. I consider Random type class a failure and ignore

P.S. For monte-carlo and thing like that I'd recommend mwc-random
it more featureful than mersenne-random and don't rely on global state

More information about the Haskell-Cafe mailing list