Intrinsic Subroutine: Computes a pseudorandom number as a single-precision value.
Syntax
Results:
The result is returned in x, which must be of type REAL(4). The result value is a pseudorandom number in the range 0.0 to 1.0. The algorithm for computing the random number value is based on the values for i1 and i2.
If i1=0 and i2=0, the generator base is set as follows:
x(n + 1 = 2**16 + 3)
Otherwise, it is set as follows:
x(n + 1 = (2**16 + 3) * x(n) mod 2**32)
The generator base x(n + 1) is stored in i1, i2. The result is x(n + 1) scaled to a real value y(n + 1), for 0.0 <= y(n + 1) < 1.
Example
REAL X
INTEGER(2) I, J
...
CALL RANDU (I, J, X)
If I and J are values 4 and 6, X stores the value 5.4932479E-04.