[erlang-questions] [ANN] xorshift128+ and xorshift64* PRNGs for Erlang
Kenji Rikitake
kenji@REDACTED
Mon Sep 22 13:34:17 CEST 2014
I've released yet another non-cryptographic random number generator
implementations for Erlang. These are still in the alpha phase, so bug
reports and enhancements welcome.
xorshift+ and xorshift* pseudo random number generators (PRNGs) look
promising as faster and more compact alternatives to Mersenne Twister PRNGs
for 64-bit execution environments. Here are the implementations in Erlang
without NIFs, with the MIT license:
xorshift+128 (exsplus)
https://github.com/jj1bdx/exsplus/
xorshift*64 (exs64)
https://github.com/jj1bdx/exs64/
xorshift+128 and xorshift*64 both generate 64-bit integer sequences.
xorshift+128 has two 64-bit integers for the internal state, and the period
is (2^127-1), the same as tinymt-erlang. The execution time of exsplus is
~x1.5 of tinymt-erlang (which generates 32-bit integer sequences) on OTP
17.3 with HiPE on OS X x86_64 and FreeBSD amd64 environments.
xorshift*64 has one 64-bit integer for the internal state, and the period
is (2^64-1). The execution time of exs64 is roughly the same but slightly
faster than exsplus.
Note: the random module algorithm (AS183), designed in 1980s, has only
three 15-bit integers for the internal state, and the period is ~(2^43).
See http://xorshift.di.unimi.it/ for the further details of xorshift+ and
xorshift* algorithms.
Regards,
Kenji Rikitake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140922/39143f89/attachment.htm>
More information about the erlang-questions
mailing list