rand48_test, a C code which calls rand48(), which demonstrates the use of several stdlib functions, which uses 48-bit arithmetic to generate uniformly distributed pseudorandom value. The results can be returned as double precision values in [0.0,1.0], or as long integers in [-2^31,2^31], or as nonnegative long integers in [0,2^31].
The underlying calculations are done in 48-bit integer arithmetic. The user has the option of allowing the system to select the initial seed, or of supplying 32 bits of the seed as a long int, or supplying all 48 bits of the seed as 3 16 bit values. The user can also supply the seed as an explicit argument on each call, or make a single initialization call with the desired seed.
Routines to set the seed:
There are 3 routines available which return a random value, assuming that the seed has been set in advance by a call to srand48, seed48, or lcong48, or that the user is satisfied with a default seed value. These routines have no input argument.
There are 3 routines available which return a random value, whose computation is determined by the value of the seed vector in the input argument. These routines do not require the user to call a seed initialization routine first.
The information on this web page is distributed under the MIT license.
rand48_test is available in a C version and a C++ version.
asa183, a C code which implements the Wichman-Hill pseudorandom number generator.
c_random_test, C codes which illustrate the use of C's random number generator routines.
faure, a C++ library which computes elements of a Faure quasirandom sequence.
halton, a C code 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 sequence using base 2.
normal, a C code which computes elements of a sequence of pseudorandom normally distributed values.
ranlib, a C 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.
sobol, a C++ library which computes elements of a Sobol quasirandom sequence.
uniform, a C code which computes elements of a sequence of pseudorandom uniformly distributed values.
van_der_corput, a C++ library which computes elements of a 1D van der Corput sequence.