Routine ID: V104 | |
---|---|
Author(s): CDC: H. von Eicken, IBM: T. Lindelöf | Library: KERNLIB |
Submitter: | Submitted: 07.12.1970 |
Language: Assembler | Revised: 15.09.1978 |
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)
RNDM generates uniformly distributed pseudo-random numbers in the interval (0,1) in type REAL and in the interval (CDC) or (IBM) in type INTEGER. The CDC version has a period of more than . The IBM period, however, is only about which may not be good enough for some calculations. In that case RNDM2 (V107) should be used instead.
Structure:
SUBROUTINE subprogram
User Entry Names: IRNDM, RNDM, RDMIN,
RDMOUT
Usage:
Y = RNDM(X)where X is a dummy argument (see Notes), sets Y to a pseudo-random number in the interval (0,1). X and Y are of type REAL.
I = IRNDM(X)where X is a dummy argument (see Notes), sets I to an integer pseudo-random number in the interval on CDC, on IBM. X is of type REAL and I is of type INTEGER.
CALL RDMOUT(SEED)replaces SEED by the current value of the integer pseudo-random number. This SEED may then be used to restart the sequence at this point, by a call to RDMIN. SEED is of type REAL.
CALL RDMIN(SEED)replaces the current value of the integer pseudo-random number by the value of the variable SEED. SEED is of type REAL. The value of SEED should not be chosen by the user but should be obtained by a previous call to RDMOUT. If this is not complied with, the numbers generated may have serious defects in their randomness.
Method:
CDC:
Consider the sequence:
| ||
| ||
|
where and are the unnormalised floating-point representation of the starting number and respectively. The j-th floating-point number is obtained by packing
with an exponent and normalising it. This ensures that
falls in the interval (0,1).
The product
is generated in a 96 bit accumulator.
The integer number
returned is the low order 47 bits of the
contents of this accumulator, except that the right-most 11 bits are
replaced by those occupying bit positions 48-58. This replacement is
done in order to increase the time period of the low order bits.
IBM:
See write-up for RNDM2 (V107).
Notes:
While the argument is dummy, in the sense that the generator makes no use of it, it must be noted that if a reference to RNDM occurs