ziggurat, an Octave code which rapidly generates random variates from 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. Getting the MATLAB code to reproduce the results of the C code has been somewhat tricky. The results seem to match the C code, but I have not tried to be efficient in my modifications.
The computer code and data files described and made available on this web page are distributed under the MIT license
ziggurat is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version.
faure, an Octave code which computes elements of a Faure quasirandom sequence.
halton, an Octave code which computes elements of a Halton quasirandom sequence.
hammersley, an Octave code which computes elements of a Hammersley quasirandom sequence.
niederreiter2, an Octave code which computes elements of a Niederreiter quasirandom sequence with base 2.
normal, an Octave code which computes elements of a sequence of pseudorandom normally distributed values.
rnglib, an Octave code which implements a random number generator (RNG) with splitting facilities, allowing multiple independent streams to be computed, by L'Ecuyer and Cote.
sobol, an Octave code which computes elements of a Sobol quasirandom sequence.
uniform, an Octave code which computes elements of uniform pseudorandom sequence.
van_der_corput, an Octave code which computes elements of a van der Corput quasirandom sequence.
George Marsaglia, Wai Wan Tsang.