JOINT   INSTITUTE   FOR   NUCLEAR   RESEARCH
lit
  Program   Library  JINRLIB rus

D_RANDOM - the random numbers generator family

V107

A.P.Sapojnikov Language: Fortran

Produces pseudorandom Real*8 numbers, uniformly distributed in open interval (0,1).
For a while there are 2 different types of generators, depending upon input value of D_Random.

Usage:

X=D_Random(N), where

N - 1,2 - type of generator (INTEGER);
X - (REAL*8) pseudorandom number in (0,1) range;

RandomInitiate(i,k) - initialization with integer numbers i,k.


N=1

The first description of this generator appeared in

G.Marsaglia and A. Zaman,
Toward a Universal Random Number Generator,
Florida State University Report: FSU-SCRI-87-50 (1987).

Generator has period 2^144. It is completely portable (gives the same series for all computers having floating point mantis length 48 bits or more).

It's the fastest generator: only 5 floating point and 3 fixed point
"Add"-instructions and no "Mult"-instructions used.

Subroutine RandomInitiate(i,k) initializes generator with two integer numbers i and k ( 0 <= i <= 31328, 0 <= k <= 30081 ).
This gives approximately 900000000 independent random series.
Default initialization is: i=1802, k=9373.
RandomInitiate defines the series only, the numbers inside the series starts from the beginning.
The complete state of this generator contains in COMMON-block:
COMMON /RanGen_Parameters/ istat(4),rstat(100)
real*8 rstat

D_Random(-999) gives istat(1) and istat(2), corresponding values of i and k for current series.


N=2

Portable random generator described in

P.L'Ecuyer, Efficient and Portable Random Number Generators,
Comm. ACM 31:743 (1988) 742.

Subroutine RandomInitiate(i,k) like above initializes this generator with two integers i > 0 and k > 0.
Default initialization is: i=1802, k=9373.
These two numbers completely defines the state of generator.
D_Random(-999) gives these values i and k.

Example:
       . . .
       implicit real*8 (a-h,o-z)
       . . .
       do i=1,5
         write(*,'(2f18.14)') D_Random(1),D_Random(2)
       enddo
       . . .
Result:
       .47444060942140   .85597053361232
       .80073601515072   .38790535493994
       .51635387886227   .14669151631475
       .30258604127470   .19100434993394
       .01901665275539   .71819570289829


home up e-mail