eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'RandomMT19937':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: RandomMT19937


Inheritance:

   Object
   |
   +--RandomMT19937

Package:
stx:libbasic2
Category:
Magnitude-Numbers-Random
Version:
rev: 1.10 date: 2018/03/02 13:04:23
user: cg
file: RandomMT19937.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Original algorithm by Takuji Nishimura and Makoto Matsumoto
Ported to Smalltalk by Claus Gittinger.

Description:


Warning: this generator should not be used for cryptographic work.

NO WARRANTY

A Mersenne Twister based on code by Takuji Nishimura and Makoto Matsumoto.

Before using, initialize the state by using initGen(seed) or initByArray(init_key).

RandomMT19937 new nextInteger
(RandomMT19937 new:5489) nextInteger
(RandomMT19937 newByArray:{16r123 . 16r234 .16r345 . 16r456}) nextInteger

If heavily used, it may be useful to embed the original C code as inline C code for a big speedup)

Please read:
    Wikipedia article on Mersenne Twister end esp. MT19937
    http://de.wikipedia.org/wiki/Liste_von_Zufallszahlengeneratoren
    MT home page http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html


Related information:

    http://www0.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf
    RandomGenerator
    -
    the
    default;
    uses
    the
    machine's
    /dev/random
    if
    available
    Random
    -
    fast,
    but
    generates
    less
    quality
    random
    numbers
    RandomTT800
    -
    another
    random
    generator
    RandomParkMiller
    -
    another
    random
    generator

Class protocol:

instance creation
o  new

o  new: seed

o  newByArray: keyArray


Instance protocol:

initialization
o  initByArray: keyArray
MSB is 1; assuring non-zero initial array

o  initGenRand: seedUsed
self new nextInteger

o  initialize
constant vector a

usage example(s):

mti==N+1 means mt[N] is not initialized */

random numbers
o  nextBoolean
generates a boolean random

o  nextInteger
generates the next integer in 0..FFFFFFFF



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 15:30:36 GMT