sfmt-erlang

sfmt-erlang: SIMD-oriented Fast Mersenne Twister (SFMT) for Erlang

Build and test commands

Use rebar3 to build since 0.14.0

Use 0.13.2 and later for OTP 23

Security notice regarding the PHP mt_seed() vulnerability

Ambionics Security published an internal state retrieval algorithm of PHP mt_rand() on 6-JAN-2020. sfmt-erlang uses the same seed-to-internal-state initialization algorithm at the function init_gen_rand/1.

For reducting the possibility of the internal state revelation, use init_by_list32/1 instead, better combined with rand:uniform/1. Raimo Niskanen published a piece of code for this purpose.

Note well that sfmt-erlang has no cryptographic security guarantee and MUST NOT be used for security purposes such as password generation.

Also: Version 0.13.0 and 0.13.1 Erlang and C code files are identical. Users have no need to upgrade.

Thanks to Shiro Kawai for the notification of the seed initialization algorithm issue.

Travis CI build status for the master branch

Build Status

License

Copyright (c) 2010-2021 Kenji Rikitake and Kyoto University. All rights reserved.

Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. All rights reserved.

See the file LICENSE for the license (new/simplified BSD license).

Details of SFMT algorithm

This software is based on SFMT ver. 1.3.3 (SIMD oriented Fast Mersenne Twister(SFMT)) by Mutsuo Saito (Hiroshima University) and Makoto Matsumoto (Hiroshima University). See http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html for the further details.

Note well: only (2^19937 - 1) period is supported.

Available modules

C NIFs

Tested platforms

hex.pm support

API compatible with the rand module

seed/3, uniform/0, uniform/1, uniform_s/1, uniform_s/3 

On HiPE usage

TODO

Code authors:

THANKS to:

ACKNOWLEDGMENTS

During the compatibility test of this software, Kenji Rikitake used the supercomputer service provided by Academic Center for Computing and Media Studies (ACCMS), Kyoto University.

Erlang Solutions kindly gave Kenji Rikitake an opportunity to give a presentation about this software at Erlang Factory SF Bay 2011.

Pepabo R&D Institute of GMO Pepabo, Inc. kindly gives the financial support for this project.