Skip to content
Derivatives Pricing and Computational Finance / Monte Carlo Methods and Stochastic Volatility

Random Number Generation

Every Monte Carlo price ultimately rests on a stream of numbers pretending to be random. This note examines that foundation: how uniform pseudo-random numbers are manufactured (and the spectacular ways cheap generators fail), and the three universal techniques — inversion, transformation, acceptance–rejection — that convert uniforms into normals and every other distribution finance needs. The failure modes are not academic: the RANDU generator shipped in production systems for years while quietly placing all its 3D points on 15 planes. Knowing what "good randomness" means, and how to test for it, is part of the quant's due diligence.
Learning objectives. By the end of this note you should be able to:
  • define samples/deviates and write the LCG algorithm with its periodicity properties;
  • state the three quality requirements for a generator and explain the lattice-structure pathology with the L2 examples;
  • state and prove the inversion theorem, and explain when inversion is the method of choice;
  • derive/state Box–Muller and the Marsaglia polar method, and explain acceptance–rejection;
  • generate samples from the other distributions used in the course (lognormal, Weibull, beta, Poisson).

In this lesson

  1. 1.1 Uniform deviates and linear congruential generators
  2. 1.2 What makes a generator good?
  3. 1.3 From uniforms to other distributions
  4. 1.4 Normal deviates
  5. 1.5 Other distributions used in the course
  6. 1.6 Worked example : simulating a stochastic integral

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or browse the Derivatives Pricing and Computational Finance syllabus.