A particularly interesting distribution of random numbers is that of
Gaussian probability. This is a distribution of random numbers which
are generated according to a Gaussian density of points. The latter, with
mean and variance
, is
A very efficient method for generating normally distributed variables
is to consider a Gaussian distribution in two dimensions (,
) for
which the number of points in a differential area is proportional to
In terms of the usual polar coordinates
Hence, if we generate between
and
with an exponential
distribution and
uniformly between
and
, then the
corresponding values of
and
To generate an arbitrary Gaussian distribution with mean and
variance
The program gaussian_points.c generates such random numbers.
Exercise:
The thing to try is to generate ten
thousand numbers and plot a histogram of these numbers. To do so
write a bin code which accepts the Gaussian numbers from standard
input and bin those numbers in arbitrarily chosen bin values. The
results of such a filter will be the basis of a histogram distribution
of the numbers. You should find that the code gaussian.c
generates random
numbers centered on and width
.
Michel Vallieres 2014-04-01