home *** CD-ROM | disk | FTP | other *** search
- Minimal Standard Random Number Generators
-
- In a recent article in the "Communications of the ACM", Stephen Park and
- Keith Miller discuss the need for good, portable industry standard
- random number generators and describe the implementation of a minimal
- standard random number generator which produces a very long sequence of
- statistically independent random numbers uniformly distributed over the
- range of 0.0 and 1.0. They go on to discuss the theory of prime modulus
- multiplicative linear congruential generators and discuss a sampling of
- inadequate generators, including IBM's infamous RANDU and the Turbo
- Pascal [Version ?] generator.
-
- Park and Miller's minimal standard random number generator has a period
- of 2,147,483,646 (2^31-2) numbers. By using an algorithm by Schrage
- which avoids potential numeric overflow problems, their algorithm can be
- implemented in high level languages for any computer which uses 32-bit
- integers and still achieve this period. Previously, one had to resort
- to assembly language coding to achieve long periods without aborting due
- to overflow and such coding is highly machine-dependent. The high level
- implementations are machine-independent and portable.
-
- This package consists of implementations of Park and Miller's minimal
- standard random number generator in Turbo C V1.5, FORTRAN-77 and in
- Turbo Pascal (V4.0).
-
- RANDOM.C is the generator written in Turbo C V1.5. It returns
- a double-precision number in the range of 0.0 to 1.0.
- RANDOM.C requires that "seed" be declared a global
- "long int" variable and that it be initialized by the
- main routine before it is called.
-
- RANDOM.FOR is the generator written in standard FORTRAN-77. It
- returns a REAL number in the range of 0.0 to 1.0.
- The seed is defined in BLOCK DATE RANSEE and can be
- initialized by calling subroutine SETRAN.
-
- RANDOM.PAS is the generator written in Turbo Pascal V4.0. It
- returns a REAL number in the range of 0.0 to 1.0.
- RANDOM.PAS requires that SEED be declared a global
- variable of type LONGINT and that it be initialized
- by the main procedure before RANDOM is called.
-
- I would appreciate your comments on, or additions to, this package.
-
- Harry M. Murphy, Consultant
- 3912 Hilton Avenue, NE
- Albuquerque, NM 87110
- Tel: (505) 881-0519
- 31 October 1988.
-
- Reference: Park, Stephen K., & Miller, Keith W., "Random Number Gener-
- ators: Good Ones are Hard to Find", in "Communications of the ACM",
- Vol. 31, No. 10 (October 1988), pp 1192 - 1201.