Next: , Previous: , Up: Internal Routines   [Contents][Index]


15.5.480 randomu

randomu( [seed=seed, period=period,] dimensions)

Returns an array with the specified dimensions, filled with uniformly distributed pseudo-random numbers. seed specifies a seed for the random numbers, and must be non-zero. The same seed generates the same sequence of pseudo-random numbers every time. Different seeds generate different sequences. If period is not specified, then the returned numbers are double and uniformly distributed between 0 and 1 (exclusive). If a value is assigned to period, then the returned numbers are long and uniformly distributed between 0 and period - 1 (inclusive). If you specify a seed but no dimensions, then the seed is set and a scalar 1 is returned.

The method used to generate the pseudo-random numbers with other distributions is Matsumoto and Nishimura’s “Mersenne Twister” mt19937 generator. The period of this generator is 2^19937 - 1, or about 1e6000.

Alias: random(/uniform)

See also: random, randomb, randomn, Random Arrays