Application Note: A Fast Time-Correlated Gaussian Random Number Generator

S. Tim Hatamian
Mathematicus Corporation

This article appears in the 1995 July/August issue of the Fortran Journal. The Fortran code for the Fast Time-Correlated Gaussian Random Generator is available in ASCII text format.

Most random number generators produce what is known as white noise. Mathematically this means:

<{epsilon}(t){epsilon}(t')> = {delta} (t - t')

where the right hand side is a Dirac delta function. What this really means is that the successive values of the random numbers are not correlated with each other. At the same time the probability distribution of the random numbers is given by a Gaussian, which means the numbers around a central-mean are more likely than others:

P({epsilon}) = 1/(sqrt(2{pi}{sigma}) exp[-({epsilon}-{epsilon}0)^2/2{sigma}^2]

The central mean {epsilon}0 is usually taken to be zero. The typical random number generator that comes with a compiler is one that is nominally "white", that is one with a probability distribution that is flat and not a Gaussian. Obtaining Gaussian random numbers from a a flat random number generator is achieved in an elegant form using the Box-Mueller algorithm. This is illustrated very nicely in Numerical Recipes (Press, Teukolsky, Vetterling and Falnnery, Cambdrige Univ. Press). Here we give a modification of this same algorithm based on the work by Fox, Gatland, Roy and Vemuri (Physical Review vol A38, p.5938, 1988). The intent here is to generate random numbers that are correlated between successive values with an exponentially decaying memory of {tau}.

<{epsilon}(t){epsilon}(t')> = (1/{tau}) exp (-|t-t'|/{tau})

The routine requires a flat random number generator which here is named RAN1. You can change this name as necessary but it refers to the fast algorithm given in Numerical Recipes.

The random number generator routine is called CGAUSS and it must be initialized in CGAUS0 which also initializes RAN1. The routine will also generate white noise when the memory {tau} is set to zero. The driver routine is one simply to calculate the correlation function given in the last equation above, and the

Without much rigorous justification the same routine could be coaxed to generate a noise series with more than one memory length. This is possible because the correlation time enters only in terms of two parameters (CAPE and L1ME2) which are fixed by CGAUS0. So if we flip these parameters between two sets calculated each for a different memory length, we can generate a noise series with a short term and a long term memory. The flipping would be decided based on a flat random number (say via RAN1). The multiple memory effect would appear as a change of slope in the graph in moving from short time delays to longer

Tim Hatamian is director of Mathematicus Corporation and may be reached at P.O. Box 1296, Sound Beach, New York, USA, 11789-0972, or by e-mail: