Portable Random Number Generators

Computers are deterministic devices, and a computer-generated random number is a contradiction in terms. As a result, computer-generated pseudorandom numbers are fraught with peril for the unwary. We summarize much that is known about the most well-known pseudorandom number generators: congruential generators. We also provide machine-independent programs to implement the generators in any language that has 32-bit signed integers-for example C, C++, and FORTRAN. Based on an extensive search, we provide parameter values better than those previously available.

An earlier version of this paper was presented at the Society for Computation Economics meeting in 1997, and the authors thank the participants for helpful comments. They also thank Stephen L. Moshier, who kindly provided many underlying routines used in the programs and helpful comments. The computer code and detailed tables are available from either author. The views expressed here are the authors' and not necessarily those of the Federal Reserve Bank of Atlanta or the Federal Reserve System. Any remaining errors are the authors' responsibility.