[Haskell-cafe] Re: Random numbers and splitting

Achim Schneider barsoap at web.de
Sun May 18 09:49:23 EDT 2008


"Lauri Oksanen" <lassoken at gmail.com> wrote:

> Hi,
> 
> Does there exists any random number generator in Haskell that is
> suitable for doing heavy simulations and that can be splitted?
> At least there exists some c implementations of such generators, see
> http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
> 
> Also some new theory for Mersenne Twister and its relatives exists,
> see http://www.iro.umontreal.ca/~lecuyer/myftp/papers/jumpf2.pdf
> http://www.iro.umontreal.ca/~lecuyer/myftp/papers/jumpmt.pdf
> 
> I'm trying to implement Metropolis algorithm with lazy mutations and
> a state space that is infinite dimensional in theory (although, of
> course, not in practice).
> Without good splitting I'm forced to write as ugly code as with
> non-lazy language.
> 
All built-in random generators Haskell has are atrociously slow. I
ended up calling sfmt via the ffi for some midpoint replacement I did,
it's on hackage now (thanks to Don):
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random
I don't know if it's usable for your case, an uneducated game
programmer like me just doesn't care about distribution properties and
such as long as it's random.

However, you might be able to implement split in
http://hackage.haskell.org/packages/archive/mersenne-random-pure64/0.1.1/doc/html/System-Random-Mersenne-Pure64.html
, and it might be fast enough for your work.



-- 
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 



More information about the Haskell-Cafe mailing list