# CS457 - System Performance Evaluation - Winter 2008

### Questions and Comments

- Midterm: Q5e
- Assignment 3

# Lecture 22 - Random Numbers

Text: chapter 12 28 & 29

## Random Variables

The mathematical foundation for random number is the random variable,
which is a variable that has different values on different occasions.

- A probability distribution determines what values a random variable
gets, and how often
- Discrete versus continuous random variables
- We usually assume that the random variables we want are independent and
identically distributed (iid or IID).
- Why is this assumption reasonable?
- Think about where we get the distributions from.

- Most random variables we use have underlying distributions that are
non-negative.
- Random variables are normally written as capitals.

#### Random variable concepts

- Cumulative distribution function (cdf or CDF):
- F(x) = P(X <= x)
- F(0) = 0
- F(infinity) = 1

- Probability density function (pdf or PDF):
- Continuous distributions only
- F(x) = \int_0^x f(x') dx'
- Mean: \mu = E(X) = \int_0^\infinity x'f(x')dx'
- Variance: \sigma^2 = X((X-E(X))^2) = \int_0^\infinity (x'-E(X))^2
f(x')dx'

- Probability mass function (pmf or PMF):
- Discrete distributions only: x takes a value fro a countable set
{x1, x2, x3, ...} where ... may or may not terminate
- P(X = xi) = pi
- \sum_i pi = 1
- F(x) = \sum_(xi<=x) pi
- Mean: E(X) = \sum_i xi pi
- Variance: \sum_i (xi - E(X) )^2 pi

In discrete event simulation we model quantities like interarrival time or
service time as IID random variables.

As a result we need to generate random variables from random number
generators.

- Random number generators normally produce random floating point numbers
uniformalu distributed between 0 and 1. (Technically, in the range
[0.0..1.0).)
- We need to know how to transform this output into the distribution we
want.

#### Random variables with arbitrary distributions

A random variable is uniquely defined by its CDF, F(x).

- 0 <= F(x) <= 1
- Suppose we want to express this random variable as a transformation Y =
g(X) of a uniformly distributed random variable.
- P(Y < y) = Fy(y) = P(X < g^-1(y) ) = Fx( g^-1(y) ).
- Choose g(x) = Fx(x). Then P(Y < y) = y, or fy(y) = 1. Y is uniformly
distributed.

#### Examples of Discrete Distributions

- Bernoulli
- Discrete uniform
- Geometric Discrete
- Binomial
- Poisson

Return to: