TestU01: A C Library for Empirical Testing of Random Number Generators PIERRE L’ECUYER and RICHARD SIMARD Universit´ e de Montr´ eal We introduce TestU01, a software library implemented in the ANSI C language, and offering a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs). It provides general implementations of the classical statistical tests for RNGs, as well as several others tests proposed in the literature, and some original ones. Predefined tests suites for sequences of uniform random numbers over the interval (0, 1) and for bit sequences are available. Tools are also offered to perform systematic studies of the interaction between a specific test and the structure of the point sets produced by a given family of RNGs. That is, for a given kind of test and a given class of RNGs, to determine how large should be the sample size of the test, as a function of the generator’s period length, before the generator starts to fail the test systematically. Finally, the library provides various types of generators implemented in generic form, as well as many specific generators proposed in the literature or found in widely-used software. The tests can be applied to instances of the generators predefined in the library, or to user-defined generators, or to streams of random numbers produced by any kind of device or stored in files. Besides introducing TestU01 , the paper provides a survey and a classification of statistical tests for RNGs. It also applies batteries of tests to a long list of widely used RNGs. Categories and Subject Descriptors: G.4 [Mathematics of Computing]: Mathematical Soft- ware; G.3 [Mathematics of Computing]: Probability and Statistics; Random Number Gener- ation; Statistical software General Terms: Statistical Software, Statistical Tests, Testing Random Number Generators Additional Key Words and Phrases: Statistical Software, Random number generators, Random number tests 1. INTRODUCTION Random numbers generators (RNGs) are needed for practically all kinds of com- puter applications, such as simulation of stochastic systems, numerical analysis, probabilistic algorithms, secure communications, computer games, and gambling machines, to name a few. The so-called random numbers may come from a physi- cal device, like thermal noise from electronic diodes, but are more often the output of a small computer program which, from a given initial value called the seed, pro- Authors’ addresses: Pierre L’Ecuyer and Richard Simard, D´ epartement d’Informatique et de Recherche Op´ erationnelle, Universit´ e de Montr´ eal, C.P. 6128, Succ. Centre-Ville, Montr´ eal, H3C 3J7, Canada, e-mail: lecuyer@iro.umontreal.ca, simardr@iro.umontreal.ca. Permission to make digital/hard copy of all or part of this material without fee for personal or classroom use provided that the copies are not made or distributed for profit or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior specific permission and/or a fee. c 20YY ACM 0098-3500/20YY/1200-0001 $5.00 ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY, Pages 1–0??.