A More Portable Fortran Random Number Generator

There are a number of situations in which it is desirable to have a random number generator that is machine independent. In general, it is useful if a program written in a high-level language produces results which are the same from machine to machine as long as the input to the program is the same. For example, the pseudorandom number generator used by the Control Data Corporation in its GPSS simulation program is the same as in IBM's GPSS, even though the generator is known to have defective statistical behavior. Apparently, compatibility is more valuable than statistical goodness. The program described here is an implementation of the generator described by Lewis et al. [6] and indirectly attributed to D.H. Lehmer. The code for the program appears in Figure 1. The generator produces a sequence of positive integers, IX, by the recursion: