CS457 - System Performance Evaluation - Winter 2008

Questions and Comments

  1. Tutorial: MC4045, Monday March 10, 18.00 to 19.00

Lecture 26

Random Number Generators - Pseudo-random Numbers

Text: Chapters 26 & 27

What we want

  1. Computationally efficient
  2. Gives good sequences of numbers
  3. Long periods
  4. Reproduce previous sequences for debugging

Linear Congruential Generators

X(n) = ( aX(n-1) + b ) mod m

How to get a full period - all possible values appear before repeating.

Choose m = 2^k for efficiency.

Testing Sequences of Random Numbers

Serial test

  1. Get adjacent pairs of numbers as points in a plane.
  2. Put them into bins: kxk.
  3. If sequence is uniform and random then P(point is in a given cell) = 1/k^2
  4. Use Kolmogorov test (or chi-square test) to check the distribution.

Gap test

  1. Choose an interval between zero and one, of length p
  2. Then P( U in interval ) = p
  3. Look at runs of points outside interval

    This is a geometric distribution

Relationship between Poisson and Exponential Distributions

Please see this pdf.

Return to: