lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




Don't forget about the Tausworthe generators. They can provide
long periods with a small amount of state space:

  http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps


The Tausworthe generators are absolutely good enough for a general purpose RNG. Initializing these generators (and the Well and Mersenne Twister generators) takes a bit of care, though. My implementation of the Well generator uses a block cipher to generate well-distributed bits that initialize the RNG.

Prof. Richard Brent has published GPL source code for his fast maximum period (up to 2^4096-1 bits) RNG, and this includes an effective initialization procedure. It's worth a look, esp. because you could use the initialization procedure for other RNGs as well. I am working on a Lua DLL that uses new implementation of this RNG. It seems to be as good as the Well generator, but it's faster.

http://wwwmaths.anu.edu.au/~brent/pub/pub224.html

Gé

--
Gé Weijers
ge@weijers.org