Introduction to the Random Numbers

By Herbert J. Bernstein
© 2003 Herbert J. Bernstein

What are Random Numbers

When a process results in events each of which has no connection with the others, we call that a random process. That does not mean that the process need have no structure. If there is a number associated with each event, even though there is no apparent connection between any two numbers, the overall distribution may fit some pattern. When we take more and more numbers, they might form a bell-shaped curve (a Gaussian distribution) or fill some interval fairly evenly (a uniform distribution) or have some other shape. We call the average expected value of the distribution the mean and we measure how widely the values are scattered by the variance (the expected value of the squares of the deviations from the mean). The square root of the variance is called the standard deviation.

When dealing with random processes, we usually have to estimate its properties experimentally. We may not know the actual mean value (μ) of the distribution, but we can estimate it as the average value of some set of sample values drawn from the distribution to get an estimated mean. Similarly we can compute an estimated standard deviation to use in place of the actual standard deviation (σ):

Estimated Mean m = (Σxi)/N
Estimated Standard Deviation s = ((Σ(xi-M)2)/N).5

There are many tests we can apply to see of the numbers we obtain from a process are truly random. For more information see D. E. Knuth, "The Art of Computer Programming, Volume 2/ Seminumerical Algorithms," Addison Wesley, Reading, MA, 1969, and "Random Number Testing and Generation" at

Why are Random Numbers Needed in Computer Programs

Pseudorandom Numbers

Timing Software

Prepared by Herbert J. Bernstein, 6 November 2003

© Copyright 2003 Herbert J. Bernstein. All Rights Reserved.