Routine ID: V107 | |
---|---|
Author(s): McGill University | Library: MATHLIB |
Submitter: T. Lindelöf | Submitted: 15.09.1978 |
Language: CDC: Fortran, IBM: Assembler | Revised: |
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
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 , 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 ( ) or to a pure congruential generator ( ). produces a sequence of only zeros.
References: