It is worth noting that the sequence is completely deterministic: if the
same initial seed, is chosen the same sequence will be
generated. This property is extremely useful for debugging purposes,
but can be a problem when averaging has to be done over several runs.
In such cases it is usual to initialise the seed from the system
clock.
Routines exist which generate a sequence of integers, as described, or
which generate floating point numbers in the range to
. Most
other distributions can be derived from these. There are also very
efficient methods for generating a sequence of random
bits (Press et al., 1992). The Numerical Algorithms Group library
contains routines to generate a wide range of distributions.
A difficult but common case is the Gaussian distribution. One method
simply averages several (say ) uniform (
) random numbers
and relies on the central limit theorem. Another method uses the fact
that a distribution of complex numbers with both real and imaginary
parts Gaussian distributed can also be represented as a distribution of
amplitude and phase in which the amplitude has a Poisson
distribution and the phase is uniformly distributed between
and
.
As an example of generating another distribution we consider the Poisson case,