Simkom-Materi Week 5 - Random-Number & Random-Variate Generation
Simkom-Materi Week 5 - Random-Number & Random-Variate Generation
Acuan:
v Harrell, C. , “Simulation Using ProModel, 2nd Edition”, The McGraw-Hill, 2004.
Content Overview 3
Generating Random
Generating Random Variates
Numbers
3
4
Behavior
Random behavior is imitated in simulation by
using a random number generator.
Random number generator is responsible for
producing this stream of independent and
uniformly distributed numbers.
The heart of the simulation is the generation of
the random variates that drive the
stochastic events in the simulation
6
Z i = (aZ i -1 + c ) mod(m )
a : the multiplier;
c : the increment;
m : the modulus;
Z0 : the seed or starting value;
a, c, m > 0 and integer
9
Linear Congruential Generators (LCG)
Zi
U i = , i = 1,2,3, !
m
10
Linear Congruential Generators (LCG)
i Zi Ui
Example of LCG
0 13
1 4 0.2500
2 7 0.4375
a = 21 3
4
6
1
0.3750
0.0625
c=3 5
6
8
11
0.5000
0.6875
m = 16
7 10 0.6250
8 5 0.3125
9 12 0.7500
10 15 0.9375
11 14 0.8750
12 9 0.5625
13 0 0.0000
14 3 0.1875
15 2 0.1250
16 13 0.8125
17 4 0.2500
18 7 0.4375
19 6 0.3750
20 1 0.0625
11
Linear Congruential Generators (LCG)
The LCG has full period if and only if the following three
conditions hold (Hull and Dobell, 1962):
1. The only positive integer that (exactly) divides both
m and c is 1
2. If q is a prime number (divisible by only itself and 1)
that divides m, then q divides a–1
3. If 4 divides m, then 4 divides a–1
13
U = 1 - e- x / b
e- x / b = 1 - U
( )
ln e - x / b = ln (1 - U )
- x b = ln (1 - U )
x = - b ln (1 - U )
The random variate x is exponentially
distributed with mean b.
21
ì0.10, x = 1
ï
p( x ) = P( X = x ) = í0.30, x = 2
ï0.60, x = 3
î
25
Generating variates
from other distributions:
Techniques and algorithms for generating variates from
other distributions:
§continuous: uniform, exponential, m-Erlang, Gamma,
Weibull, normal, lognormal, beta, Pearson type V, Pearson
type VI, triangular, empirical distribution,
§discrete: Bernoulli, discrete uniform, arbitrary discrete
distribution, binomial, geometric, negative binomial,
Poisson
see Law and Kelton, Simulation Modeling and
Analysis, Chapter 8.
27
Activity
a 21
m 128
c 3
betha-1 3 Arrival to ATM
betha-2 2.4 ATM Processing Time
27
28
28