How Computers Generate Random Numbers

How Computers Generate Random Numbers
Synopsis: How can computers, which are completely deterministic machines, generate "random" numbers?


Many computer programming languages today include a function for generating random numbers. This paper presents some background theory in basic probability theory and inferential statistics. We then present a number of empirical tests for analyzing a computer generated sequence of random numbers, and we apply these tests to several popular random number generators.


Paradoxes of Probability

A treatise on probability theory wouldn't be complete without a number of paradoxes to thoroughly confuse you. Here are a few classic ones.


Generating random integers within a desired range
How to generate random numbers in the range:
r = [0,1) a real value
x = [0,M) a real value
y = [0,M) an integer value
z = [1,M] an integer value


Using the C and C++ rand() function

How to use the rand() random number generator.




Back to Deley's Home Page

mailbox email David Deley: deleyd@ieee.org