Michael A. Carchidi March 14, 2013
Chapter 7 - Random-Number Generation Random number are a necessary basic ingredient in the simulation of almost all discrete systems. You may never have to write a computer program to generate random numbers because all simulation software have built-in subroutines, objects, or functions that will generate random numbers. However, it is still important to understand the basic ideas behind the generation (and testing) of random numbers. These random numbers are then used (Chapter 8) to generate other random variables. This chapter describes the generation of random numbers and their subsequent testing for randomness (uniformity and independence), but first we discuss some basic properties of random numbers. 7.1 Properties of Random Numbers A sequence of random numbers {R1 , R2 , R3 , . . . , Rn , . . .} must have two important properties: (a) uniformity and (b) independence.
Each random number Ri is an independent sample drawn from a continuous uniform distribution between zero and one (i.e., U[0, 1)) whose pdf and cdf are given by ⎧ ⎧ x≤0 x 0
(m1 − 1)/m1 , for Xi = 0
k k Y µ mj − 1 ¶ 1 Y . (mj − 1) = 2 P = k−1 2 2 j=1 j=1
Example #3: Still Another Linear Congruence Using k = 2 generators with a1 = 40, 014, a2 = 40, 692, m1 = 2, 147, 483, 563 and m2 = 2, 147, 483, 399 leads to Xi+1,1 = 40, 014Xi,1 mod(2, 147, 483, 563) 10
and Xi+1,2 = 40, 692Xi,2 mod(2, 147, 483, 399) and and Ri = ⎧ ⎨ Xi /2, 147, 483, 563, ⎩ Xi = (Xi,1 − Xi,2 ) mod(2, 147, 483, 563 − 1) for Xi > 0 .
2, 147, 483, 562/2, 147, 483, 563, for Xi = 0
Using seeds X0,1 in the range [1, 2, 147, 483, 562] and X0,2 in the range [1, 2, 147, 483, 398], this generator leads to a period of P = (2, 147, 483, 562)(2, 147, 483, 398) = 2, 305, 842, 648, 436, 451, 838 2
or P = 2.3 × 1018 , which (in seconds) is 4.6 times larger than the accepted age of the known universe (5 × 1017 seconds). ¥ Perhaps surprisingly, even