See Section 7.2 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), Cambridge University Press, 1992.The GAUSSIAN_FUNCTION function creates a Gaussian kernel used in convolution. These keywords will continue to work, but new code should use the RANDOMU function instead.ġ. Deprecated BINOMIAL, GAMMA, LONG, NORMAL, POISSON, UNIFORM keywords. Version HistoryĬhanged to use the Mersenne Twister algorithm, added RAN1 keyword. See RANDOMU for details on the old algorithm. Set this keyword to use the older ran1 algorithm, which was the default in IDL 8.1 and earlier. See the DOUBLE keyword in RANDOMU for details on how the double-precision numbers are constructed. Set this keyword to return a double-precision random number. If no dimensions are specified, RANDOMN returns a scalar result. If multiple arguments are specified, they must all be scalar expressions. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. D iĮither an array or a series of scalar expressions specifying the dimensions of the result. See the Seed argument in RANDOMU for details. ArgumentsĪ 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. Returns an array containing the random numbers of the specified dimensions. Plot the probability function of random numbers: x = RANDOMN(SEED, 100000) h = HISTOGRAM(x, BINSIZE= 0.1, LOCATIONS=hlocs) p = BARPLOT(hlocs, h) To create a 10 by 10 array of normally-distributed, random numbers, type: R = RANDOMN(seed, 10, 10) For example, entering 7.0 as the Seed produces the same result as using 7.5 or 7.9. Note: For Seed values equal to a non-whole number, such as float, RANDOMN uses the whole number portion of the constant Seed. See RANDOMU for more discussion of the random number generator. The uniform random numbers required for the Box-Miller method are generated using the Mersenne Twister algorithm. RANDOMN uses the Box-Muller method, based off of the gasdev algorithm 1. Using the RANDOMN function is equivalent to using RANDOMU with the /NORMAL keyword, and is provided as a programming convenience. The RANDOMN function returns one or more pseudorandom numbers from a normal (Gaussian) distribution with a mean of zero and a standard deviation of one.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |