RANDOM NUMBER GENERATION
Week 3
Kelton text (Ch. 12)
GE-703 Kumpaty
Generating Random Numbers
LCG (linear congruential generators)
Zi
= (a Zi-1 +c) mod (m)
Mixed (above); Multiplicative when c=0.
Seed value Z0
Maximum cycle length achieved is m.
Promodel uses a=630360016 c=0 and
m=231-1 prime modulus multiplicative LCG
Arena (used to have same m, c, a=16807)
Cycle length in 100 unique streams
Generating Random Numbers
Zi = (a Zi-1 +c) mod (m) Guidelines for selection of m,a and c.
Random Number Generators
Will the following LCG work?
Zi = (12Zi-1+5) mod (32) with Z0 = 29
i
0
1
2
3
4
5
Zi
29
1
17
17
17
17
It wont work because a=4k+1 is violated.
Testing Random Number Generators
1. Testing for independence
Hypothesis:
H0: Ui values from the generator are
independent (Ui for uniform distr. Zi/m)
H1: Ui values from the generator are not
independent
Specified significance level
The Runs test
The Runs Above and Below the Median Test
The Runs Up and Runs Down Test
Testing Random Number Generators
2. Testing for uniformity/homogeneity
Hypothesis:
H0: Ui values are uniform
H1: Ui values are not uniform
Specified significance level
The Kolmogorov-Smirnov test
The Chi-Square test
Will do in Chapter 6
Generating Random Variates
Inverse Transformation Method
CONTINOUS Distributions
f(x) probability distribution function
F(x) cumulative distribution function,
F(x) =P(X<=x)
Set U= F(x) where U is uniform (0,1) and
solve for x.
x= F-1(U); x is the random variate
Cumulative Distribution function for
Uniform Distribution
Pr (0 x x0) = F(x0) = a x0 1/(b-a) dx
F(x0) = (x0-a)/(b-a)
Also if the cumulative probability F(x0) is known
we can also determine x0 as
x0 = a+(b-a) F(x0)
Example: b=7; a=4; given F(x0)=0.53, x0 =5.59
Cumulative Distribution function for
Exponential Distribution
Pr (0 x x0) = F(x0) = 0 x0 b e-bx dx
F(x0) = - e-bx 0|x0 = 1 - e-bx0
Also if the cumulative probability F(x0) is known
we can also determine x0 as
x0 = (-1/b) ln(1 F(x0))
Please note (1/b) is the mean of the exponential
distribution.