next up previous
Next: Bibliography Up: The RNG Random Number Previous: Fortran Interface


Testing of the RNG Library

In this section we discuss some of the testing done, both theoretical and experimental, on the RNG library routines. First, number theory can be used to demonstrate that the algorithms in the RNG library have maximal period (see discussion regarding each algorithm) and to limit the choice for the multipliers (e.g., the potency test as described in [8]). Further checks of the ``goodness'' of a pseudo random number generator must be done experimentally. Extensive testing has been performed on the 64-bit linear congruential generator of section 3.1, on the 61-bit prime modulus linear congruential generator of section 3.4, and on the 48-bit modulus linear congruential generator of section 3.2 by the developers of SPRNG [1] library. We have duplicated the constants used in the SPRNG library for these generators in order to leverage their testing efforts. To insure that we duplicated the SPRNG arithmetic, we seeded the RNG routines and the equivalent SPRNG routines with the same values 4, and compared their results for a large number of advances on several different architectures (see Table 1).

The RNG library was also compared to Mathematica calculations for a large number of advances in order to check the accuracy of our implementation of modular arithmetic. Furthermore, on the IRIX64 machine listed in Table 1 the RNG library was tested with 1012 advances to insure that the values returned by the iRng(), dRng() and fRng() routines are within the specified limits. A more satisfying test of the returned value was done by seeding a RNG state with the value that when advanced once produces the maximum (minimum) value allowed by the generator. The iRng(), dRng() and fRng() routines also passed this last test on the platforms listed in Table 1.

It is important that one run these tests on any new platform port in order to defend against any problems that crop up due to compiler differences. One can run the command make test in the build directory in order to accomplish this. This command will run the random number generators in the library to insure that they produce the correct state as compared against built-in tables that record past behavior. After this check, the approximate timings of the iRng(), dRng() and fRng() routines are reported in Million Randoms per Second (MRS). Finally, the generators are seeded with the values that produce, on the next call, the minimum and maximum values for the iRng(), dRng() and fRng() routines. These routines are called and the returned values are printed to standard output. The maximum double and float values should be the same as those printed to standard output by the program one-eps.c in the Test sub-directory. To compile and run this program enter the command make one-eps in the Test sub-directory. Note, in most cases the maximum double value should match that produced by one-eps.c; however, for some generators the value is slightly less due to the fact that there is no double value which when multiplied by the maximum value of that generator produces the nearest-to-one value that is less than one.

We are currently engaged in extensive statistical testing of the new prime modulus generators we have introduced in the RNG library, comparing them to those derived from the SPRNG package, and will report on the results of this testing in a separate paper.


Table 1: List of operating systems (OS) and processors that the RNG library was tested on and some timing information. The rate is quoted as Millions of Randoms per Second (MRS). The rows labeled by nrand48 and erand48 are the measured performance of the system provided generators, for comparison purposes. The rows labeled by SPRNG are the measured performance of the named generators from the SPRNG library for comparison purposes.
OS OSF1 IRIX64 SunOS AIX HP-UX Linux
Processor DEC SGI sparc IBM PA- AMD
  alpha R10000 SUNW PPC RISC K-6
  (EV56)     604e   II
Clock Speed (MHz) 440 185 250 332 180 333
iRng64 (MRS) 33.15 8.43 3.99 20.62 3.03 9.77
dRng64 (MRS) 18.25 4.86 3.09 10.99 0.64 2.56
iRngP61 (MRS) 7.03 0.99 1.02 2.60 1.10 1.80
dRngP61 (MRS) 7.68 1.01 1.04 3.26 0.48 1.60
nrand48 (MRS) 2.33 5.43 0.69 4.50 0.76 1.51
erand48 (MRS) 2.45 4.29 0.63 3.05 0.64 1.30
SPRNG/ilcg64 (MRS) 10.89 10.53 1.33 1.45 1.85 0.82
SPRNG/dlcg64 (MRS) 7.58 7.19 1.51 1.35 2.13 1.03
SPRNG/ipmlcg61 (MRS) 5.59 2.37 0.36 0.37 0.61 1.36
SPRNG/dpmlcg61 (MRS) 4.41 2.22 0.35 0.36 0.56 1.07



next up previous
Next: Bibliography Up: The RNG Random Number Previous: Fortran Interface