ziggurat_inline


ziggurat_inline a C++ code which generates variates from the uniform, normal or exponential distributions, using an inline random number generator for very fast execution, by Marsaglia and Tsang.

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 MIT license

Languages:

ziggurat_inline is available in a C version and a C++ version.

Related Data and Programs:

ziggurat_inline_test

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:

  1. 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.
  2. 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:


Last revised on 09 May 2022.