Non-uniform Generators
Numbers selected from a non-uniform probability distribution can be generated using a uniform distribution PRNG and a function that relates the two distributions.
First, one needs the cumulative distribution function of the target distribution :
Note that . Using a random number c from a uniform distribution as the probability density to "pass by", we get
so that
is a number randomly selected from distribution .
For example, the inverse of cumulative Gaussian distribution with an ideal uniform PRNG with range (0, 1) as input would produce a sequence of (positive only) values with a Gaussian distribution; however
- when using practical number representations, the infinite "tails" of the distribution have to be truncated to finite values.
- Repetitive recalculation of should be reduced by means such as ziggurat algorithm for faster generation.
Similar considerations apply to generating other non-uniform distributions such as Rayleigh and Poisson.
Read more about this topic: Pseudorandom Number Generator