SHTOOLS --- Tools for working with spherical harmonics

> Home > Documentation > Python > Other

RandomGaussian

Return a pseudo-Gaussian deviate of zero mean and unit variance.

Usage

rg, seed = pyshtools.RandomGaussian (seed)

Returns

rg: float
The radom Gaussian deviate.
seed : integer
The output value of seed should be input into the function to obtain the next random deviate.

Parameters

seed : integer
Input a negative integer to (re-)initialize the random number generator. Afterwards, this argument should not be modified.

Description

RandomGaussian will return a Gaussian random deviate with unit variance and zero mean. The underlying random number generator uses the algorithm of Park and Miller combined with a Marsaglia shift sequence, which is claimed to have a periodicity of about 3.1 10^18. The random number generator is intialized by calling with a negative value of seed, and afterwards, this variable should not be modified. To obtain a Gaussian deviate with a standard deviation of sigma, it is only necessary to multiply the unit variance deviate by sigma.

This is a slightly modified version of the algorithm that was published in NUMERICAL RECIPES as GASDEV.

References

Press, W.H., S.A. Teukolsky, W.T. Vetterling, and B.P. Flannery, Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed., Cambridge Univ. Press, Cambridge, UK, 1992.

See also

randomn

> Home > Documentation > Python > Other

Institut de Physique du Globe de Paris University of Sorbonne Paris Cité © 2016 SHTOOLS