ABSTRACT

Rand() can hurt designers project because many implementations still use a linear congruential random number generator (LCG), a family of random number generators that were in use as early as 1949. Many tools still use rand() today to generate integers, real numbers, and Boolean values. Such vintage random number generators are still here because they are fast and simple, not because they work well. This chapter explains what an LCG is, how it works, and how it can hurt designers project when used to generate random Boolean values, for example. Both linearity and periodicity of LCGs can be easily visualized by plotting the points made of the pairs of successive numbers that have been generated. All LCGs repeat themselves for some value of n, including rand(). Over the years, many empirical and theoretical tests have been developed to assess the performance of LCGs, thus pushing forward the search for better LCGs.