From Wikipedia, the free encyclopedia
Jump to: navigation, search

TestU01 is a software library, implemented in the ANSI C language, that offers a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs).[1] The library was first introduced in 2007, by Pierre L’Ecuyer and Richard Simard of the Université de Montréal.[2]

The library implements several types of random number generators, including some proposed in the literature and some found in widely used software. It provides general implementations of the classical statistical tests for random number generators, as well as several others proposed in the literature, and some original ones. These tests can be applied to the generators predefined in the library, user-defined generators, and streams of random numbers stored in files. Specific tests suites for either sequences of uniform random numbers in [0,1] or bit sequences are also available. Basic tools for plotting vectors of points produced by generators are provided as well.


An initial battery of statistical tests for uniform RNGs was offered by the 1969 first edition of The Art of Computer Programming, by Donald Knuth. In testing of RNGs, Knuth's tests were supplanted by George Marsaglia's (1996) Diehard tests, which consisted of fifteen different tests. The inability to modify the test parameters or add new tests led to the development of the TestU01 library.


TESTU01 offers four groups of modules for analyzing RNGs:

  1. Implementing (pre-programmed) RNGs;
  2. implementing specific statistical tests;
  3. implementing batteries of statistical tests; and
  4. Applying tests to entire families of RNGs.

When a specific test is applied to a sample of size n produced by an RNG, the p-value of the test usually will remain reasonable as the sample size increases until the sample size hits n0, say. After that, the p-value diverges to 0 or 1 with exponential speed. Module 4 allows the researcher to study the interaction between a specific test and the structure of the point sets produced by a given family of RNGs. This technique can be used to determine how large the sample size should be, as a function of the generator's period length, before the generator starts to fail the test systematically.

TESTU01 offers several batteries of tests including "Small Crush" (which consists of 10 tests), "Crush" (96 tests), and "Big Crush" (106 tests). The specific tests applied by each battery are detailed in the User's Guide.[3] On a 1.7 GHz Pentium 4 running Red Hat Linux 9.0, for a simple RNG, Small Crush takes about 2 minutes. Crush takes about 1.7 hours. Big Crush takes about 12 hours. For a more complex RNG, all these times increase by a factor of two or more. For comparison, the Diehard tests take about 15 seconds to run.


  1. ^ The TestU01 web site.
  2. ^ Pierre L’Ecuyer & Richard Simard (2007), "TestU01: A Software Library in ANSI C for Empirical Testing of Random Number Generators", ACM Transactions on Mathematical Software, 33: 22.
  3. ^ TestU01 User's Guide.