9.3.121 RAN (I)

Description:  Returns the next number from a sequence of pseudorandom numbers of uniform distribution over the range 0 to 1.[1]  
Class:  Nonelemental function; Specific 
Arguments:  I is the seed. It must be an INTEGER(4) variable or array element.

It should initially be set to a large, odd integer value. The RAN function stores a value in the argument that is later used to calculate the next random number.

There are no restrictions on the seed, although it should be initialized with different values on separate runs to obtain different random numbers. 

Results:  The result type is REAL(4). The result is a floating-point number that is uniformly distributed in the range between 0.0 inclusive and 1.0 exclusive. It is set equal to the value associated with the argument I. 

[1] RAN is not a pure function, so it cannot be referenced inside a FORALL construct.


In RAN (I), if variable I has the value 3, RAN has the value 4.8220158E-05.

Previous Page Next Page Table of Contents