ranm(3f)
NAME
ranm, iran, rndmze, ransav, ranres − uniform pseudorandom number generator package
SYNTAX
double precision function ranm()
subroutine iran(i1, i2, i3, i4, i5, i6)
integer*2 i1, i2, i3, i4, i5, i6
subroutine rndmze
subroutine ransav(ivec)
integer*2 ivec(269) subroutine ranres(ivec)
integer*2 ivec(269)
DESCRIPTION
The ranm function returns a uniform(0,1) pseudorandom double precision number.
The iran subroutine may be called with user specified arguments to initialize the generator. Different inputs to iran result in different output sequences from ranm.
The rndmze calls iran with unpredictable arguments.
The ransav subroutine saves the entire current internal state of the generator into the array ivec.
The ranres subroutine restores the entire internal state of the generator as previously saved by ransav in the array ivec.
The iran, ransav or ranres subroutines should not be used in the same program with rndmze.
ALGORITHM
The ranm function uses two linear congruential generators and a 64-entry shuffle table.
On each call, two pseudorandom 31 bit integers are generated by the linear congruential method: N(i+1) = M * N(i) (mod P) where P = 2**31 − 1. M = 7**13 (mod P) for one generator and 7**23 (mod P) for the other. (The period of each linear congruential generator is 2**31 - 2.) The resulting 62 bits are used as follows: The first 56 bits form a pseudorandom double precision number in the interval [0,1). The last 6 bits determine a random address in the shuffle table (between 0 and 63) into which to insert the double precision number just formed.
The internal state of ranm is the contents of the two linear congruential seeds and of the shuffle table.
On the first call, ranm generates 64 double precision numbers and inserts them (randomly, according to the above method) into the shuffle table.
RESTRICTIONS
All six arguments to iran must be different to ensure a different output sequence from ranm.