The RANDOMN function returns one or more pseudo-random numbers with a normal (Gaussian) distribution with a mean of zero and a standard deviation of one. Using the RANDOMN function is equivalent to using RANDOMU with the /NORMAL keyword, and is provided as a programming convenience.
RANDOMN uses the Box-Muller method, based off of the gasdev algorithm1 . The uniform random numbers required for the Box-Miller method are generated using the Mersenne Twister algorithm. See RANDOMU for more discussion of the random number generator.
Note: For Seed values equal to a non-whole number, such as float, RANDOMN uses the whole number portion of the constant Seed. For example, entering 7.0 as the Seed produces the same result as using 7.5 or 7.9.
To create a 10 by 10 array of normally-distributed, random numbers, type:
R = RANDOMN(seed, 10, 10)
Plot the probability function of random numbers:
x = RANDOMN(SEED, 100000)
h = HISTOGRAM(x, BINSIZE=0.1, LOCATIONS=hlocs)
p = BARPLOT(hlocs, h)
Returns an array containing the random numbers of the specified dimensions.
A variable or constant used to initialize the random sequence on input, and in which the state of the random number generator is saved on output. See the Seed argument in RANDOMU for details.
Either an array or a series of scalar expressions specifying the dimensions of the result. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. If multiple arguments are specified, they must all be scalar expressions. Up to eight dimensions can be specified. If no dimensions are specified, RANDOMN returns a scalar result.
Set this keyword to return a double-precision random number. See the DOUBLE keyword in RANDOMU for details on how the double-precision numbers are constructed.
Set this keyword to use the older ran1 algorithm, which was the default in IDL 8.1 and earlier. See RANDOMU for details on the old algorithm.
|8.2.2||Changed to use the Mersenne Twister algorithm, added RAN1 keyword. Deprecated BINOMIAL, GAMMA, LONG, NORMAL, POISSON, UNIFORM keywords. These keywords will continue to work, but new code should use the RANDOMU function instead.|
1. See Section 7.2 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), Cambridge University Press, 1992.
This page has no comments yet. Be the first one!