CS457 - System Performance Evaluation - Winter 2010

Public Service Announcements

Lecture 20 - Random Variables

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

  1. A probability distribution determines what values a random variable gets, and how often
  2. Discrete versus continuous random variables
  3. We usually assume that the random variables we want are independent and identically distributed (iid or IID).
  4. Most random variables we use have underlying distributions that are non-negative.
  5. Random variables are normally written as capitals.

Random variable concepts

  1. Cumulative distribution function (cdf or CDF):
  2. Probability density function (pdf or PDF):
  3. Probability mass function (pmf or PMF):

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 variables with arbitrary distributions

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

The most important distribution for performance evaluation - The exponential distribution

An exponential identity

The Poisson process


Example - Radioactive Decay


  1. A huge number of radioactive atoms, independent of one another
  2. Each has the same probability of decay

Bring in a geiger counter



For an open system

Event* new-arrival-event( time ){
    Event* evt = malloc( sizeof( Event ) );
    evt->type = ARRIVAL;
    evt-time = time + rand-exp( <arrival rate> );
    return evt;

We have to determine how to create a random number with an exponential distribution, and it had better be efficient because we do it a lot.

Closing Message

Despite the somewhat facetious tone of the above notes there is actually quite a lot of evidence that Poisson/Exponential distributions occur frequently in the sort of thing likely to provide requests to systems we evaluate.

Other Distributions

The exponential distribution pretty well takes care of arrival events in open systems. What about

These are normally modelled based on distributions that are abstractions of behaviour observed in logs or traces. Here are a few that turn up from time to time.

Bernoulli & BinomialDistributions

Systems that are easily categorized into two distinct homogeneous classes.


Think times

Service times


Coin-flipping is the natural analogue, but it covers any binary choice made at (biased!) random.

How do you sample a Bernoulli distribution in practice


Make N binary choices at random, all identical.

How do you sample a binomial distribution in practice

  1. Small N: sample a Bernoulli N times,
  2. Medium N: divide the range [0,L) into N+1 parts proportional to (N choose k) and do binary search with u
  3. Large N: converge to another distribution

Return to: