[ThinAir Home] [Table of Contents] [Bad Pseudo-Random Number Generators] [Utility Functions and Classes]

11 Testing a Generator

George Marsaglia at Florida State University has collected/developed a set of tests that exercise a sequence of numbers to determine how unpredictable they are. The randfile.pl Perl script gives an easy way to build the random number file needed to test a generator using DIEHARD. Execute the perl script randfile.pl. The script gives you the opportunity to select a generator and to supply parameters to the constructor for that generator. When you are finished, the script generates the file randfile.cpp. Compile randfile.cpp and run RandFile. The program asks you for a filename and then creates a file that it fills with approximately 11MB of random numbers. This file may be passed to DIEHARD for testing.

Included in the source for ThinAir is the file rand.cpp. I used this file for interface testing and regression testing of the library. If an interface is functioning incorrectly, the output contains the word error. Otherwise, the test works through a series of generators, printing useful signposts and information to standard output. When making a low-level change to the library, I would save the output of a run. After making my changes, I would recompile and save the output of a new run. There should be no differences between the two output files. This approach is especially useful during the porting of ThinAir to a new compiler or platform.


For further information, contact G. Wade Johnson (gwadej@anomaly.org).

© 1997 G. Wade Johnson. All rights reserved.
http://www.anomaly.org/ThinAir/testing.html