Skip to content


Subversion checkout URL

You can clone with
Download ZIP
sfmt-erlang: SIMD-oriented Fast Mersenne Twister (SFMT) for Erlang
Erlang C Other
Failed to load latest commit information.
c_src Update sfmt_nif.c for loops to prevent gotofail
priv added priv/.gitignore as the placeholder
reference_texts modified to include sfmt module to the modules variable
src Update src/sfmt_tests.erl
test Add common_test tests
test_scripts added test_scripts/fprof-pure.escript for sfmt_pure analysis
.travis.yml Update .travis.yml with Common Test script add support
Doxyfile Doxyfile: Add project name and info
Makefile Add new Makefile for
Makefile.sfmt Update and Makefile.sfmt for NIF machine type detection Update tested on 17.4 Update (with c_src patch)
package.exs Add name of package.exs contributor Michael Chmielewski

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

  • Version 0.10.1 7-NOV-2014
  • Edited and written by Kenji Rikitake (Kenji Rikitake Professional Engineer's Office)
  • Email contact:

Travis CI build status for the master branch

Build Status


Copyright (c) 2010-2014 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 for the further details.

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

Available modules

  • module sfmt: SFMT with C NIFs
  • module sfmt_pure: SFMT with pure Erlang
  • See for the detail of miscellaneous changes


  • Compiler requirement: C99 support (modern Clang and gcc will do): <inttypes.h> required
  • See c_src/sfmt_nif.c for the details
  • Also refer to sfmt-extstate at
  • The version number of this NIF is 101 (see NIF_LOAD_INFO macro value)

Tested platforms

  • FreeBSD/amd64 10.1-STABLE with Erlang/OTP 17.4
  • OS X 10.10.1 Yosemite with Erlang/OTP 17.4

Make options (of

  • Makefile works on both BSD/GNU make
  • Makefile.sfmt is the real GNU make file; edit this file for modification
  • Building: make
  • C NIF Documentation: make c_doc (requires Doxygen or later)
  • Erlang Documentation: make docs
  • Testing: make tests
  • Execution speed benchmark: make speed
  • See also for the details support

  • Package name: sfmt
  • See package.exs

API compatible with the random module

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


  • No more new feature; more load testing needed
  • More documentation
  • Code upgrading/reloading behavior check

Code authors:

  • Kenji Rikitake
  • Mutsuo Saito
  • Makoto Matsumoto
  • Dan Gudmundsson
  • Michael Truog
  • Michael Chmielewski


  • Dave "dizzyd" Smith
  • Tuncer Ayaz
  • Tim Bates (random_mt.erl implementator of Mersenne Twister)
  • Richard O'Keefe
  • Yurii Rashkovskii
  • Kostis Sagonas
  • Michael Gebetsroither
  • Shunichi Shinohara
  • Loïc Hoguin


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.

Something went wrong with that request. Please try again.