[Haskell-cafe] Re: Hangman game

Yitzchak Gale gale at sefer.org
Mon Jan 21 19:41:30 EST 2008

Achim Schneider wrote:
> Speaking of that, the generators that come in the box are awfully slow,
> I ended up calling into
> http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
> via the ffi.

Yes, it would be nice to have the Mersenne Twister available.
Not only for speed - it is widely used, so it could sometimes
be very useful for us to be able to generate random sequences that
are bit-compatible with the sequences generated in other

> I wouldn't know how to fit it into the Random type, though, it only
> supports floats and doubles, and converting the C source to use a
> struct for its data to make it instantiable is another obstacle.

A few people worked all of that out. It's not a big deal. But it never
was quite finished and put into the libraries.

Yes, it is all the rage these days to do the calculations
in floating point, due to the properties of current processors.

It's not a problem to fit it into the RandomGen class - just
convert to an Int when you're done. But that slows things
down. Too bad the current Random class always
forces you to go through Int. It was a good idea back then.
We could fix this without breaking any current code.


More information about the Haskell-Cafe mailing list