CS457 - System Performance Evaluation - Winter 2008

Questions and Comments

Lecture 23 - Useful Distributions for Random Numbers

Text: chapter 28 & 29

Random Variables

Random variables with arbitrary distributions

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

To Create a Random Variable with and Arbitrary Distribution, fx(x)

  1. Calculate the CDF: Fx(x) = \int_0^x fx(x') dx'
  2. Get one sample of a uniformly distributed random number, u.
  3. Solve the equation u = Fx(x) for x, which amounts to calculating x = Fx^-1(u).

It's important to do this fast.

Examples of Discrete Distributions

This emphasizes `what it's good for' over equations or theorems.

1. Arbitrary

An arbitrary discrete distribution is a map from value to probability

Order on xi to calculate the CDF,

Solve u = Fx(x) graphically.

2. Discrete Uniform

M uniformly spaced values, from m to n

Choose u,

4. Bernoulli

Flip a (biased) coin

But really heads = 1, tails = 0.


  1. Get u.
  2. If u < 1-p then 0; else 1

5. Geometric

Probability of getting it right after x-1 failures

CDF is p*\sum_0^x (1 - p)^x' = p * (1-(1-p)^x) / (1 - (1 - p)) = 1-(1-p)^x

Exercise for the reader: redo this using the graphical method.

6. Binomial Distribution

Get exactly x correct in n tries.

There is no way of doing the sum we did for the geometric distribution,

So, generate n Bernoulli variables and sum them.

Return to: