next up previous index
Next: V109 Random Numbers Up: CERNLIB Previous: V107 IBM Uniform

V108 Portable Gaussian Random Number Generator

Routine ID: V108
Author(s): F. JamesLibrary: MATHLIB,IBM and VAX only
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: RNORML or RNORMX (V120)

RG32 generates random numbers distributed according to a Gaussian distribution of mean zero and variance one. It produces exactly the same REAL numbers on any computer of word length at least 32 bits. On computers with longer words, the lower bits will be zero. It is intended for testing calculations across different machines and for other applications where it is desired to have exactly the same numbers generated on different machines. It is not recommended for delicate Monte Carlo calculations involving more than 105 random Gaussian variates.

Structure:

SUBROUTINE and FUNCTION subprograms
User Entry Names: RG32, RG32IN, RG32OT

Usage:

    X = RG32(DUMMY)
assigns to X the next number in a sequence of pseudorandom real numbers in a Gaussian distribution of mean zero and variance one. The generator does not require initialization, but it may be started with a particular odd integer ISEED by calling:
    CALL RG32IN(ISEED)
where ISEED should be between 5 and 10 decimal digits long. The current value of the seed may be found by calling:
    CALL RG32OT(ISEED)
where the value in ISEED will be the current seed value. With the default starting value of the seed ( 875949887) the first three 'Gaussian' pseudorandom numbers generated are:
    1.    1.613800048828
    2.    -.931945800781
    3.     .363372802734

Method:

Pseudorandom integers are generated according to the multiplicative congruential method using the same multiplier ( 69069) as RN32 (V106). Twelve consecutive integers are added, and the sum appropriately rounded, truncated, floated, and normalized. The resulting distribution is of course only approximately Gaussian, but the difference is not statistically significant for sequences of reasonable length (a few million). The method assures that no values will be returned outside the interval (-6.,+6.) , whereas a true Gaussian distribution would have a finite but very small probability outside that interval.

Notes:

Although RG32 uses the same method and multiplier as RN32, the RG32 default starting seed corresponds to the 10003-rd value coming from RN32 (with its default starting seed), so that the two can be considered as independent for sequences that are not too long. This means, however, that care must be exercised if the user wishes to reset the seeds using RN32IN and RG32IN, in order to avoid possible correlations.

V109



next up previous index
Next: V109 Random Numbers Up: CERNLIB Previous: V107 IBM Uniform


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