mtRandom
- Mersene Twister random number generator

Statistical functions
(AmiBroker 50)


SYNTAX mtRandom( seed = Null )
mtRandomA( seed = Null )
RETURNS NUMBER or ARRAY
FUNCTION mtRandom( seed = Null ) - returns single random number (scalar) in the range [0,1)
mtRandomA( seed = Null ) - returns array of random numbers in the range of [0,1)

seed is random generator seed value. If you don't specify one, the random number generator is automatically initialized with current time as a seed that guarantees unique sequence

Both functions use Mersene Twister mt19973ar-cok algorithm. (Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura.)

Mersene Twister is vastly superior to C-runtime pseudo-random generator available via Random() function.

It has a period of 2^19973 = approx 2.9*10^6012 For more information visit: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

See also: M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3--30.

EXAMPLE printf("Random number: %g", mtRandom() );
SEE ALSO RANDOM() function

References:

The mtRandom function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.