This preview shows pages 1–6. Sign up to view the full content.
DA6530: Performance Models of Computers and Networks
CDA6530: Performance Models of Computers and Networks
hapter 5: Generating Random Number
Chapter 5: Generating Random Number
and Random Variables
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document bjective
Objective
se computers to simulate stochastic
Use computers to simulate stochastic
processes
earn how to generate random variables
Learn how to generate random variables
Discrete r.v.
Continuous r.v.
Basis for many system simulations
2
Pseudo Random Number Generation (PRNG)
x = a x

mod m
n
n 1
Multiplicative congruential generator
x
n
= {0, 1,
, m1}
x /m is used to approx. distr. U(0,1)
n
x
0
is the initial “seed”
Requirements:
No. of variables that can be generated before
o o
a ab es
a ca be ge e a ed be o e
repetition begins is large
For any seed, the resultant sequence has the
“ ppearance” of being independent
appearance of being independent
The values can be computed efficiently on a
computer
3
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
x = a x
mod m
n
n1
m should be a large prime number
For a 32bit machine (1 bit is sign)
m=2
31
1 = 2,147,483,647
a = 7
5
= 16,807
or a 36 it machine
For a 36 bit machine
m= 2
35
31
a = 5
5
x
n
= (ax
n1
+ c) mod m
Mixed congruential generator
4
C Programming Language
In C Programming Language
Int rand(void)
Return int value between 0 and RAND_MAX
RAND_MAX default value may vary between
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 01/14/2012 for the course CDA 6530 taught by Professor Zou during the Fall '11 term at University of Central Florida.
 Fall '11
 Zou

Click to edit the document details