next up previous
Next: References Up: THE KERNEL BENCHMARKS Previous: Kernel IS: Parallel

A Pseudorandom Number Generator for the Parallel NAS Kernels

D. Bailey

Suppose that n uniform pseudorandom numbers are to be generated. Set and let be a specified initial ``seed,'' i.e., an integer in the range . Generate the integers for using the linear congruential recursion

and return as the results. Thus , and the are very nearly uniformly distributed on the unit interval. See [2], beginning on page 9 for further discussion of this type of pseudorandom number generator.

Note that any particular value of the sequence can be computed directly from the initial seed s by using the binary algorithm for exponentiation, taking remainders modulo after each multiplication. To be specific, let m be the smallest integer such that , set b = s and t = a. Then repeat the following for i from 1 to m:

The final value of b is . See [2] for further discussion of the binary algorithm for exponentiation.

The operation of multiplying two large integers modulo can be implemented using 64 bit floating point arithmetic by splitting the arguments into two words with 23 bits each. To be specific, suppose one wishes to compute . Then perform the following steps, where int denotes the greatest integer:

An implementation of the complete pseudorandom number generator algorithm using this scheme produces the same sequence of results on any system that satisfies the following requirements:

These requirements are met by virtually all scientific computers in use today. Any system based on the IEEE-754 floating point arithmetic standard [1] easily meets these requirements using double precision. However, it should be noted that obtaining an exact power of two constant on some systems requires a loop rather than merely an assignment statement with **.

Other Features


next up previous
Next: References Up: THE KERNEL BENCHMARKS Previous: Kernel IS: Parallel