HP MLIB User's Guide Vol. 2 7th Ed.
616 HP MLIB User’s Guide
SRAN/DRAN Scalar long period random number generator
Notes Starting a sequence twice with the same value of iseed will produce the same
pseudorandom sequence.
You may have as many independent sequences going at a time as you desire by
having a different iseed for each one.
The subprograms treat iseed as an unsigned 48-bit quantity. To write it out for
later continuation of the same sequence, either use unformatted I/O statements
or write it out with an octal, unsigned integer, or hexadecimal format descriptor
of the form O16, SU, I15, or Z12, respectively. Alternatively, in the absence of
INTEGER*8, use 2O12, SU, 2I/O or 2Z8, respectively.
Example Fill an array X that is 10 elements long with a sequence of pseudorandom
numbers using the scalar subprogram SRAN.
INTEGER*4 N
INTEGER*8 ISEED
REAL*4 SRAN,X(10)
ISEED = 1234 ! STARTING SEED
N = 10
DO I = 1, N
X(I) = SRAN(ISEED)
END DO
This fills array X with the same sequence of pseudorandom numbers and also
returns the same final value of ISEED, as does the “Example” on page 619 for
SRANV.