ZIGGURAT_INLINE
Ziggurat Method for Exponential or Normal Random Numbers
ZIGGURAT_INLINE
is a C++ library which
rapidly generates random variates from the uniform, normal or
exponential distributions.
The uniform numbers are generated directly. The ziggurat method is used
to compute the normal and exponential values.
In this version, the underlying generators are implemented "inline",
invoking a function call only in exceptional cases. This results in
very fast execution.
Licensing:
The computer code and data files made available on this web page
are distributed under
the GNU LGPL license.
Languages:
ZIGGURAT_INLINE is available in
a C version and
a C++ version.
Related Data and Programs:
FAURE,
a C++ library which
computes elements of a Faure quasirandom sequence.
HALTON,
a C++ library which
computes elements of a Halton quasirandom sequence.
HAMMERSLEY,
a C++ library which
computes elements of a Hammersley quasirandom sequence.
NIEDERREITER2,
a C++ library which
computes elements of a Niederreiter quasirandom sequence with base 2.
NORMAL,
a C++ library which
computes elements of a sequence of pseudorandom normally distributed values.
SOBOL,
a C++ library which
computes elements of a Sobol quasirandom sequence.
UNIFORM,
a C++ library which
computes elements of uniform pseudorandom sequence.
VAN_DER_CORPUT,
a C++ library which
computes elements of a van der Corput quasirandom sequence.
ZIGGURAT,
a C++ program which
generates points from a uniform, normal or exponential distribution, using
the ziggurat method.
ZIGGURAT_OPENMP,
a C++ program which
demonstrates how the ZIGGURAT library can be used to generate random numbers
in an OpenMP parallel program.
Reference:
-
Philip Leong, Guanglie Zhang, Dong-U Lee, Wayne Luk, John Villasenor,
A comment on the implementation of the ziggurat method,
Journal of Statistical Software,
Volume 12, Number 7, February 2005.
-
George Marsaglia, Wai Wan Tsang,
The Ziggurat Method for Generating Random Variables,
Journal of Statistical Software,
Volume 5, Number 8, October 2000, seven pages.
Source Code:
Examples and Tests:
List of Routines:
-
CONG_SEEDED evaluates the CONG generator for uint32_t's.
-
CONG_VALUE evaluates the CONG generator for uint32_t's.
-
CPU_TIME returns the current reading on the CPU clock.
-
EFIX generates variates when rejection occurs in the exponential code.
-
KISS_SEEDED evaluates the KISS random number generator.
-
KISS_VALUE evaluates the KISS generator for uint32_t's.
-
MWC_SEEDED evaluates the MWC multiply-with-carry random number generator.
-
MWC_VALUE evaluates the MWC generator for uint32_t's.
-
NFIX generates variates when rejection occurs in the normal code.
-
R4_EXP_SETUP sets data needed by R4_EXP.
-
R4_EXP_VALUE returns an exponentially distributed float.
-
R4_NOR_SETUP sets data needed by R4_NOR.
-
R4_NOR_VALUE returns a normally distributed float.
-
R4_UNI_VALUE returns a uniformly distributed float.
-
SHR3_SEEDED evaluates the SHR3 generator for unsigned 32 bit integers.
-
SHR3_VALUE evaluates the SHR3 generator for unsigned 32 bit integers.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
-
ZIGGET gets the seeds.
-
ZIGSET sets the seeds and creates the tables for the Ziggurat method.
You can go up one level to
the C++ source codes.
Last revised on 18 October 2013.