New random module?

Kenji Rikitake kenji.rikitake@REDACTED
Wed Nov 24 09:00:25 CET 2010

In the message <20101123155847.77783a5f@REDACTED>
dated Tue, Nov 23, 2010 at 03:58:23PM +0100,
Cristian Greco <cristian@REDACTED> writes:
> The actual prng in Erlang is intrinsecally limited in many ways.

Sure it is.

> IMHO you should rework your MT nif implementation and submit it as a
> patch for stdlib. A bonus would be the code to provide access to
> OS-dependant randomness sources (e.g. /dev/urandom in *nix, CryptoApi
> in windows), in order to automatically initialize the generator with a
> "non-hardcoded" seed.

I've been planning to evaluate the following five PRNGs:

* Current random module (Wichmann-Hill 1982, state: 6 bytes: period: ~ 10^13)
* SFMT (period 2^19937-1, state: 2496 bytes)
* Wichmann-Hill 2006, state: 16 bytes, period: ~ 2^120
* XORshift 7 stage (Panneton-L'Ecuyer, 2005[1], state: 8 bytes, period: 2^256-1)
* SFMT with smaller state (period 2^607-1, state: 66 bytes)

Obtaining entropy from /dev/urandom will be surely a good feature.
(I have no Windows dev environment available at hand)

Kenji Rikitake

More information about the erlang-questions mailing list