Previous: File Array Creation, Up: Array Creation [Contents][Index]

LUX offers various functions that return *pseudo-random* numbers.
These numbers are determined by a fixed deterministic algorithm, so the
numbers are not random in the sense that nobody can know which number
will be generated next. A main advantage of using a deterministic
algorithm is that of reproducibility: If you restart the algorithm with
the same starting conditions, then it produces the same sequence of
numbers.

Of course, to be useful, the pseudo-random numbers generated by the algorithm must share a sufficient number of properties with truly random numbers. For instance, the number of pseudo-random numbers in any given interval of values must be statistically indistinguishable from those in a truly random sequence, and the correlation between any two pseudo-random numbers at a fixed distance of each other in the pseudo-random sequence should be statistically zero.

The method used by LUX to generate pseudo-random numbers (other than random bits) is the MT19937 “Mersenne Twister” generator of Makoto Matsumoto and Takuji Nishimura, which has a period of 2^19937 - 1 and passes most statistical tests. LUX generates random bits using a primitive polynomial modulo 2.

The pseudo-random number functions LUX offers are:

RANDOMB( [SEED =seed,]dimensions) RANDOMD( [SEED =seed,]distribution,dimensions) RANDOME(scale,dimensions) RANDOMU( [SEED =seed, PERIOD =period,]dimensions) RANDOMN( [SEED =seed,]dimensions) RANDOM( [SEED =seed, PERIOD =period,]dimensions[, /UNIFORM, /NORMAL, /SAMPLE, /SHUFFLE, /BITS])

The `randomb`

function returns random bits. The `randomu`

function returns uniformly distributed integer or floating-point
numbers. The `randomn`

function returns numbers normally
distributed with zero average and unit variance. The `randomd`

function returns integer numbers distributed according to a
user-specified distribution. The `randome`

function returns
numbers exponentially distributed across the whole range of
representable numbers. The `random`

function selects a
distribution by keyword. `randomu`

is an alias of
`RANDOM,/UNIFORM`

, and `randomn`

is an alias of
`RANDOM,/NORMAL`

.

See also: random, randomb, randomd, randome, randomn, randomn

Bibliography:

- - D.E. Knuth: "Seminumerical Algorithms", 2nd Edition, Addison-Wesley, Reading, MA (1981).
- - Stephen K. Park and Keith W. Miller: "Random Number Generators: Good Ones Are Hard To Find", Communications of the ACM, volume 31, pp. 1192–1201 (1988).
- - W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery: "Numerical Recipes in C", 2nd edition, Cambridge University Press: chapter 7 (1992)
- - R.C. Tausworthe: "Random Numbers Generated by Linear Recurrence Modulo Two", Mathematics of Computation, volume 19, p. 201 (1965)
- - E.J. Watson: "Primitive Polynomials (Mod 2)", Mathematics of Computation, volume 16, p. 368 (1962)
- - Makoto Matsumoto and Takuji Nishimura: "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1 (Jan. 1998), Pages 3â30

Previous: File Array Creation, Up: Array Creation [Contents][Index]