~ ~ ~ PURPOSE ~ ~ ~ This function generates random numbers ranging from 0.0 to 1.0. In the process of calculating the random number, the seed (x1) is set to a new value. This function implements the prime-modulus generator xi = 16807 xi Mod(2**(31) - 1) using code which ensures that no intermediate result uses more than 31 bits the theory behind the code is summarized in Bratley, P., B.L. Fox and L.E. Schrage. 1983. A Guide to Simulation. Springer-Verlag, New York. (pages 199-202)
~ ~ ~ OUTGOING VARIABLES ~ ~ ~ name |units |definition ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ unif |none |random number between 0.0 and 1.0 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ LOCAL DEFINITIONS ~ ~ ~ name |units |definition ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ x2 |none |variable to hold calculation results ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout) | :: | x1 |