Pseudorandom Numbers

by Nikolai V. Shokhirev

Up: Stochastic Labs
Pseudorandom numbers
-  Probability transformation
Diffusion, Wiener process
Geometric Brownian motion
-  Ornstein-Uhlenbeck process


In this lab we will take a closer look on various types of pseudorandom numbers.


Test Random.

Linear congruential generators (LCG)

LCG is one of the oldest and best-known family of pseudorandom number generator (PGNG) algorithms (see links below). They are simple and fast. The algorithms are defined by the recurrence relation:

X n+1 = ( a X n + c ) mod m

The quality of random numbers is defined by the constants a, c and m (see some sets of constants here). Borland C++ and Delphi PRNG belong to this family of algorithms.

Borland PGN uniform distribution.

These algorithms can be used in simple applications. However, they are not suitable for Monte Carlo simulations (especially multidimensional) because of the serial correlations.

Mersenne twister

The algorithm is fast and generates high quality random numbers suitable for stochastic processes simulations (Monte Carlo, Diffusion, etc.). In the picture below the sum of 12 random numbers models the normal distribution.

Mersenne twister "Normal" distribution.

Below is the same distribution averaged over 5 bins.

Smoothed normal distribution

Low-discrepancy sequences

A n-dimensional low-discrepancy sequence (LDS) is represents uniformly distributed points in the n-dimensional cube (see definitions in the links below). In the 1D case it produces almost perfect rectangular distribution:

Sobol 1D sequence.

The use of LDSs accelerates the Monte Carlo methods (e.g. integration). However, because of their "regularity", they should not be used for simulation of certain random processes. For example, the sum of two (pseudo)-random uniformly distributed numbers has the triangular distribution: 

Triangular (xi + xi+1)/2 distribution.

However the sum of two consecutive Sobol numbers has the rectangular distribution again:

Rectangular (xi + xi+1)/2 distribution for the Sobol sequence..

Feel free to download the program Test Random and play (at your own risk) with various PRN. I am adding several new features, please check later.


Test Random.

Some references

ABC Tutorials | Data Processing | Indirect Measurements | NMR Tutorials

Home | Resumé | |  Computing |  Links Publications

©Nikolai V. Shokhirev, 2007-2008