c_random_test


c_random_test, C codes which illustrate the use of random number generator routines.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

c_random_test is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

ASA183, a C code which implements a pseudorandom number generator, by Wichman and Hill. This is a version of Applied Statistics Algorithm 183.

NORMAL, a C code which computes elements of a sequence of pseudorandom normally distributed values.

RAND48, a C code which demonstrates the use of the rand48 family of random number generators available in the C/C++ standard library.

RANDLC, a C code which generates a sequence of pseudorandom numbers, used by the NAS Benchmark programs.

RNGLIB, a C code which implements a random number generator (RNG) with splitting facilities, allowing multiple independent streams to be computed, by L'Ecuyer and Cote.

UNIFORM, a C code which computes elements of a uniform pseudorandom sequence.

VAN_DER_CORPUT, a C code which computes elements of a 1D van der Corput Quasi Monte Carlo (QMC) sequence using a simple interface.

Examples and Tests:

DRAND48_TEST shows how to use the standard library routines SRAND48 to set the seed and DRAND48 to return random real numbers in [0,1].

RAND_DEFECT_TEST points out a minor problem with generating real numbers by calling TIME to seed SRAND and then dividing RAND() by RANDMAX, namely, the first value returned will be about the same every time you run the program:

RAND_TEST shows how to use the standard library routines SRAND to set the seed and RAND to return random integers which can be scaled to real numbers in [0,1].

RANDOM_TEST shows how to use the standard library routines SRANDOM to set the seed and RANDOM to return random integers which can be scaled to real numbers in [0,1].


Last revised on 15 June 2019.