next up previous index
Next: V107 IBM Uniform Up: CERNLIB Previous: V105 Arrays of

V106 Machine-Independent Uniform Random Numbers

Routine ID: V106
Author(s): F. JamesLibrary: MATHLIB
Submitter: Submitted: 10.01.1986
Language: FortranRevised:

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)

RN32 generates random numbers uniformly distributed in the interval (0,1). It produces exactly the same REAL numbers on all computers of word length at least 32 bits. On CDC, the lower 28 bits are always zero. The generator is of the usual multiplicative congruential type with a 'good' multiplier (69069). It gives good results for short sequences but is not recommended for delicate calculations involving more than 106 random numbers.

Structure:

SUBROUTINE subprogram
User Entry Names: RN32, RN32IN, RN32OT
External References: IAND (M441)

Usage:

The generator RN32 does not require initialisation, but it can be started or restarted with a given 'seed' if desired.

    X = RN32(DUMMY)
generates a random number X of type REAL.
    CALL RN32IN(IX)
where IX (type INTEGER) must be an odd integer of at least 5 decimal digits, ≤21474836647 , sets a starting seed equal to IX.
    CALL RN32OT(IX)
where IX where of type INTEGER, returns the current value of the seed in IX.

Method:

The default value of the starting seed is 65539. The multiplicative congruential method is used to generate a series of 31-bit integers by multiplying the previous integer by 69069 and keeping only the lower 31 bits. This is then converted to a REAL number by first masking off the lower 8 bits to assure that the conversion can be done exactly on a machine with 32-bit word length, floating the resulting integer and multiplying by the float of 2-31 .

V107



next up previous index
Next: V107 IBM Uniform Up: CERNLIB Previous: V105 Arrays of


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