next up previous index
Next: V108 Portable Gaussian Up: CERNLIB Previous: V106 Machine-Independent Uniform

V107 IBM Uniform Random Number Generator

Routine ID: V107
Author(s): McGill UniversityLibrary: MATHLIB
Submitter: T. LindelöfSubmitted: 15.09.1978
Language: CDC: Fortran, IBM: AssemblerRevised:

OBSOLETE

Please note that this routine has been obsoleted in CNL 215. Users are advised not to use it any longer and to replace it in older programs. No maintenance for it will take place and it will eventually disappear.
Suggested replacement:
RANMAR (V113) or RANECU (V114) or RANLUX (V115)

RNDM2 is a combined multiplicative congruential generator and a shift register generator with nearly optimal lattice structure in 2, 3, 4 and 5 dimensions, with a period of about 5 x1018

numbers, designed especially for the IBM where the 32-bit word length makes the usual generators ( RNDM, RN32) not good enough for some calculations. A Fortran version of RNDM2 exists on CDC for compatibility reasons, but the CDC version is not recommended for production use. It only functions as an interface to RNDM (V104).

Structure:

FUNCTION subprogram
User Entry Names: RNDM2, IRNDM2, RD2IN, RD2OUT

Usage:

    U = RNDM2(DUMMY)
assigns to U a random normalized floating point value in the interval (0,1), with uniform distribution.
    K = IRNDM2(DUMMY)
assigns to K a random integer value in the interval (0,231) , with uniform distribution.
    CALL RD2OUT(IS,JS)
sets IS and JS to the current values of two internal registers used in the congruential generator and the shift register generator respectively.
    CALL RD2IN(IS,JS)
resets the two above-mentioned registers to IS and JS respectively. The entire future sequence of generated numbers is a function of IS and JS.

In order to avoid loss of randomness it is advisable to use for IS and JS only values obtained through an earlier call to RD2OUT. Either parameter may be set to zero in order to reduce the generator to a pure shift register generator (IS=0 ) or to a pure congruential generator (JS=0 ). IS=JS=0 produces a sequence of only zeros.

References:

  1. G. Marsaglia, K. Ananthanarayanan and N. Paul, Comm. ACM l5 (1972) 873.

V108



next up previous index
Next: V108 Portable Gaussian Up: CERNLIB Previous: V106 Machine-Independent Uniform


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995