CAUTION: this software is no longer maintained. Migrate to the default rand module for OTP 18 and later because they are well-supported and use faster and better algorithms.
rebar3 compile
doxygen
(requires Doxygen 1.9.1 or later)rebar3 edoc
rebar3 ct
rebar3 shell
and run sfmt_tests:test_speed()
and sfmt_pure_tests:test_speed()
rebar3 clean
-lerl_interface
. This is required for a successful build in OTP 23.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.
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).
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.
sfmt
: SFMT with C NIFssfmt_pure
: SFMT with pure Erlang<inttypes.h>
requiredc_src/sfmt_nif.c
for the detailsNIF_LOAD_INFO
macro value)sfmt
seed/3, uniform/0, uniform/1, uniform_s/1, uniform_s/3
sfmt_pure
module can be compiled with HiPE or +native "+{hipe, [o3]}"
erlc compile option, which will result in 40% to 100% speedup on 64-bit machinesDuring 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.