ANN: ERLMT - Mersenne Twister in Erlang

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ANN: ERLMT - Mersenne Twister in Erlang

David Fox
Hi all,

I am happy to announce the availability of Mersenne Twister (MT) in
erlang. MT is a Random Number Generator (RNG) that is supposed to be
both fast and have an astronomical period of 2**19937-1. For more
information about MT in general, please take a look at
http://www.math.keio.ac.jp/~matumoto/emt.html.

The erlang version is available at http://www.wallin.cx. The package is
named 'erlmt.tar.gz' and contains a module 'mt19937' that is an MT
implementation in erlang. The package also contains an erl driver to a
MT implementation in C. Due to licensing issues, I did not include it
but you also need to get a file called 'cokus.c' to get this working. It
should be available on the sites above.

The MT in erlang is unfortuantely, really slow, improvements are
welcome. The erl driver is somewhat faster than the random module
included in erlang but still really slow.

Benchmarks.

All results are the number of random numbers generated during 10
seconds. This was done on a 500 MHz iBook running R7B-3 under OS X
(v10.0.3).

Running 'random' module included in erlang :

Eshell V5.0.2.4  (abort with ^G)
1> mt:test_original().
453310
2> mt:test_original().
461197
3> mt:test_original().
453171
4> mt:test_original().
452647
5> mt:test_original().
451646

Running the erl driver :

6> mt:test_batch().
526033
7> mt:test_batch().
527492
8> mt:test_batch().
525341
9> mt:test_batch().
520284
10> mt:test_batch().
519777

Running the erlang implementation of MT :

11> mt19937:test().
162603
12> mt19937:test().
154129
13> mt19937:test().
168823
14> mt19937:test().
159121
15> mt19937:test().
163391


Any comments, suggestions, improvements and bugfixes are welcome. Also,
I would be interested in similar benchmarks with the HiPE compiler.



--david.