ZIGGURAT, a FORTRAN90 code which implements a random number generator (RNG) for the uniform, normal or exponential distributions, by Marsaglia and Tsang.
The uniform numbers are generated directly. The ziggurat method is used to compute the normal and exponential values.
In the reference, the underlying generators are implemented "inline", invoking a function call only in exceptional cases. This results in very fast execution.
In this implementation, the advantages of inline code are not used. All the routines and inline functions are isolated in a separate file, so that a user invokes them through the familiar library interface.
This code is a translation of software written in C. The C code used unsigned integers for the underlying SHR3 algorithm. The FORTRAN90 code uses signed integers, and for this reason, the FORTRAN90 version of the exponential random number algorithm does not match the C version - that is, for the same initial seed value, different results emerge from the two codes. Whether this seriously affects the validity of the FORTRAN90 results remains to be checked.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
ZIGGURAT is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.
FAURE, a FORTRAN90 code which computes elements of a Faure quasirandom sequence.
HALTON, a FORTRAN90 code which computes elements of a Halton quasirandom sequence.
HAMMERSLEY, a FORTRAN90 code which computes elements of a Hammersley quasirandom sequence.
NIEDERREITER2, a FORTRAN90 code which computes elements of a Niederreiter quasirandom sequence with base 2.
NORMAL, a FORTRAN90 code which computes elements of a sequence of pseudorandom normally distributed values.
RANLIB, a FORTRAN90 code which produces random samples from Probability Density Functions (PDF's), including Beta, Chi-square Exponential, F, Gamma, Multivariate normal, Noncentral chi-square, Noncentral F, Univariate normal, random permutations, Real uniform, Binomial, Negative Binomial, Multinomial, Poisson and Integer uniform, by Barry Brown and James Lovato.
RBOX, a C program which generates a set of points in a region, selected at random according to a given distribution.
SOBOL, a FORTRAN90 code which computes elements of a Sobol quasirandom sequence.
UNIFORM, a FORTRAN90 code which computes elements of uniform pseudorandom sequence.
VAN_DER_CORPUT, a FORTRAN90 code which computes elements of a van der Corput quasirandom sequence.
ZIGGURAT_OPENMP, a FORTRAN90 code which demonstrates how the ZIGGURAT library can be used to generate random numbers in an OpenMP parallel program.
George Marsaglia, Wai Wan Tsang.