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:
Previous: File Array Creation, Up: Array Creation [Contents][Index]