RANLIB
General Random Number Generators (RNG's)
RANLIB
is a MATLAB library which
produces random samples from Probability Density Functions (PDF's),
including Beta, Chisquare Exponential, F, Gamma, Multivariate normal,
Noncentral chisquare, Noncentral F, Univariate normal, random permutations,
Real uniform, Binomial, Negative Binomial, Multinomial, Poisson
and Integer uniform,
by Barry Brown and James Lovato.
RANLIB relies on streams of uniform random numbers generated
by a lower level package called RNGLIB. A copy of RNGLIB
must be available in order for RANLIB to executed.
The RNGLIB routines provide 32 virtual random number generators.
Each generator can provide 1,048,576 blocks of numbers, and each block
is of length 1,073,741,824. Any generator can be set to the beginning
or end of the current block or to its starting value. Packaging is
provided so that if these capabilities are not needed, a single
generator with period 2.3 X 10^18 is seen.
The routines, and the probability density functions they sample, include:

GENBET, Beta distribution;

GENCHI, ChiSquare distribution;

GENEXP, Exponential distribution;

GENF, F distribution;

GENGAM, Gamma distribution;

GENMN, multivariate normal distribution;

GENMUL, multinomial distribution;

GENNCH, noncentral ChiSquare distribution;

GENNF, noncentral F distribution;

GENNOR, normal distribution;

GENUNF, uniform distribution on [0,1];

IGNBIN, binomial distribution;

IGNLGI, uniform distribution on integers between 1
and 2147483562;

IGNNBN, negative binomial distribution.

IGNPOI, Poisson distribution.

IGNUIN, uniform distribution on integers in a given range.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
RANLIB is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
ASA183,
a MATLAB library which
implements a random number generator (RNG),
by Wichman and Hill.
This is a MATLAB version of Applied Statistics Algorithm 183.
FAURE,
a MATLAB library which
computes elements of a Faure quasirandom sequence.
HALTON,
a MATLAB library which
computes elements of a Halton quasirandom sequence.
HAMMERSLEY,
a MATLAB library which
computes elements of a Hammersley quasirandom sequence.
NIEDERREITER2,
a MATLAB library which
computes elements of a Niederreiter quasirandom sequence with base 2.
NORMAL,
a MATLAB library which
computes elements of a
sequence of pseudorandom normally distributed values.
PDFLIB,
a MATLAB library which
evaluates Probability Density Functions (PDF's)
and produces random samples from them,
including beta, binomial, chi, exponential, gamma, inverse chi,
inverse gamma, multinomial, normal, scaled inverse chi, and uniform.
PROB,
a MATLAB library which
evaluates, samples and inverts a number of Probability Density Functions (PDF's).
RANDLC,
a MATLAB library which
implements a random number generator (RNG)
used by the NAS Benchmark programs.
RANDOM_SORTED,
a MATLAB library which
generates vectors of random values which are already sorted.
RNGLIB,
a MATLAB library which
implements a random number generator (RNG) with splitting facilities,
allowing multiple independent streams to be computed,
by L'Ecuyer and Cote.
SOBOL,
a MATLAB library which
computes elements of a Sobol quasirandom sequence.
UNIFORM,
a MATLAB library which
computes elements of a pseudorandom uniform sequence.
VAN_DER_CORPUT,
a MATLAB library which
computes elements of a van der Corput quasirandom sequence.
WALKER_SAMPLE,
a MATLAB library which
efficiently samples a discrete probability vector using
Walker sampling.
Author:
Original FORTRAN77 version by Barry Brown, James Lovato.
MATLAB version by John Burkardt.
Reference:

Joachim Ahrens, Ulrich Dieter,
Computer Methods for Sampling From the
Exponential and Normal Distributions,
Communications of the ACM,
Volume 15, Number 10, October 1972, pages 873882.

Joachim Ahrens, Ulrich Dieter,
Generating Gamma Variates by a Modified Rejection Technique,
Communications of the ACM,
Volume 25, Number 1, January 1982, pages 4754.

Joachim Ahrens, Ulrich Dieter,
Computer Generation of Poisson Deviates
From Modified Normal Distributions,
ACM Transactions on Mathematical Software,
Volume 8, Number 2, June 1982, pages 163179.

Joachim Ahrens, Ulrich Dieter,
Computer Methods for Sampling from Gamma, Beta, Poisson and
Binomial Distributions,
Computing,
Volume 12, Number 3, September 1974, pages 223246.

Joachim Ahrens, Ulrich Dieter,
Extensions of Forsythe's Method for Random
Sampling from the Normal Distribution,
Mathematics of Computation,
Volume 27, Number 124, October 1973, page 927937.

Russell Cheng,
Generating Beta Variates with Nonintegral Shape Parameters,
Communications of the ACM,
Volume 21, Number 4, April 1978, pages 317322.

Luc Devroye,
NonUniform Random Variate Generation,
Springer, 1986,
ISBN: 0387963057,
LC: QA274.D48.

Voratas Kachitvichyanukul, Bruce Schmeiser,
Binomial Random Variate Generation,
Communications of the ACM,
Volume 31, Number 2, February 1988, page 216222.

Pierre LEcuyer, Serge Cote,
Implementing a Random Number Package with Splitting Facilities,
ACM Transactions on Mathematical Software,
Volume 17, Number 1, March 1991, pages 98111.
Source Code:

genbet.m,
generates a beta random deviate.

genchi.m,
generates a ChiSquare random deviate.

genexp.m,
generates an exponential random deviate.

genf.m,
generates an F random deviate.

gengam.m,
generates a Gamma random deviate.

genmn.m,
generates a multivariate normal deviate.

genmul.m,
generates a multinomial random deviate.

gennch.m,
generates a noncentral ChiSquare random deviate.

gennf.m,
generates a noncentral F random deviate.

gennor.m,
generates a normal random deviate.

genprm.m,
generates and applies a random permutation to an array.

genunf.m,
generates a uniform random deviate.

ignbin.m,
generates a binomial random deviate.

ignnbn.m,
generates a negative binomial random deviate.

ignpoi.m,
IGNPOI generates a Poisson random deviate.

ignuin.m,
generates a random integer in a given range.

lennob.m,
counts the length of a string, ignoring trailing blanks.

phrtst.m,
converts a phrase to a pair of random number generator seeds.

prcomp.m,
prints covariance information.

r4_exp.m,
evaluates the exponential function while avoiding overflow and
underflow.

r4_exponential_sample.m,
samples an exponential distribution.

r4vec_covar.m,
computes the covariance of two R4VEC's.

r8_exponential_sample.m,
samples an exponential distribution.

r8vec_covar.m,
computes the covariance of two R8VEC's.

setcov.m,
sets a covariance matrix from variance and common correlation.

setgmn.m,
sets data for the generation of multivariate normal deviates.

sexpo.m,
evaluates the standard exponential distribution.

sgamma.m,
returns a deviate from the standard Gamma distribution.

snorm.m,
returns a deviate from the standard normal distribution.

spofa.m,
factors a real symmetric positive definite matrix.

stats.m,
computes statistics for a given array.

trstat.m,
returns the mean and variance for distributions.
Examples and Tests:

ranlib_test.m,
calls all the tests.

ranlib_test_phrtsd.m,
tests PHRTSD.

ranlib_test_bot.m,
tests the bottomlevel random number generation.

ranlib_test_genbet.m,
tests GENBET.

ranlib_test_genchi.m,
tests GENCHI.

ranlib_test_genexp.m,
tests GENEXP.

ranlib_test_genf.m,
tests GENF.

ranlib_test_gengam.m,
tests GENGAM.

ranlib_test_gennch.m,
tests GENNCH.

ranlib_test_gennf.m,
tests GENNF.

ranlib_test_gennor.m,
tests GENNOR.

ranlib_test_genunf.m,
tests GENUNF.

ranlib_test_ignbin.m,
tests IGNBIN.

ranlib_test_ignnbn.m,
tests IGNNBN.

ranlib_test_ignpoi.m,
tests IGNPOI.

ranlib_test_output.txt,
the output from a run of the sample program.
You can go up one level to
the MATLAB source codes.
Last revised on 19 September 2014.