MS&E 223
Lecture Notes #6
Simulation
Uniform Variate Generation
Peter J. Haas
Spring Quarter 200910
Uniform Variate Generation
Refs
: Law Ch. 7;
Simulation
(Ed. Henderson et al.) Ch
.
3.; Knuth,
The Art of Computer
Programming
, Vol. 2, Ch. 3.
We now discuss the question of how to generate i.i.d. uniform random variables on a computer.
As we
have seen, uniform randomness is the basis of all the randomness that one simulates on a computer.
1.
PseudoRandom Numbers
Perhaps surprisingly, the basis of most RNG algorithms is a deterministic recurrence relation: the
sequence starts with an initial “seed”, and then each “random number” in the sequence is a deterministic
function of the previous random number. Although these numbers form a deterministic dependent
sequence, if the generation algorithm is well designed the numbers will
appear
to be random and
independently distributed. For this reason such numbers are called
pseudorandom
numbers.
An important property of pseudorandom numbers is that a given sequence can be repeated again at a
later time. This repeatability property is useful because
•
it
facilitates debugging of simulation programs
•
it permits an efficiency improvement technique called “common random numbers” (to be
discussed later)
2.
Linear Congruential Generators
The most commonly used generators, in practice, are linear congruential generators (LCG’s).
A sequence
of integers is generated via the recursion
01
x,x,
…
n1
n
x
(ax
c)
mod
m
+
=+
where a, c, and m are integers also known, respectively, as the multiplier, increment and modulus.
Remark
:
k mod m is the integer obtained by dividing k by m and computing the remainder (e.g., 14 mod
5 = 4, 26 mod 21 = 5).
It follows that the
are integers in the set {0, 1, .
.., m
−1
}.
To obtain the
pseudorandom uniform sequence
, one sets
n
x'
s
U,U,
…
nn
Ux
/
m
=
.
Clearly, a LCG produces periodic output, with period
≤
m.
Full period is desirable because:
•
It increases the potential number of random variates one can reliably use in a simulation.
•
If the generator is not of full period, then there are gaps in the output sequence.
The nature of
such gaps for an LCG is not well understood, and may create distinctly nonrandom behavior
in the output.
Page 1 of 8
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentMS&E 223
Lecture Notes #6
Simulation
Uniform Variate Generation
Peter J. Haas
Spring Quarter 200910
So, at a minimum, one should choose a, c and m to have full period. (Though a full period by itself does
not guarantee that the sequence has nice statistical properties). There are known sufficient conditions for
this.
LCG’s run faster if the increment c is set equal to 0. Such an LCG is called a multiplicative generator.
In
practice, most LCG’s are multiplicative generators (also called Lehmer generators).
3.
Multiplicative Generators
For a multiplicative generator, 0 is a “trap” state, for if
n
x0
=
for some n, then all future values of
will
be zero.
So, for a multiplicative generator, one says that the generator is of full period if for any initial
seed
k
x
{ }
0
x1
,
,
m
1
∈
…
−
, the sequence
visits all m
−
1 integers in the set {1, .
.., m
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '09
 UNKNOWN
 Randomness, Peter J. Haas, Simulation Peter J., Uniform Variate Generation, Variate Generation Spring, Generation Spring Quarter

Click to edit the document details