Random number generators generate random numbers that tend to follow some kind of distribution. Uniform number generators generate a random number between 0 and 1 with equal likely hood everywhere in the range, Gaussian generators generate numbers that have higher probability to be near zero, etc. These distributions are given functions ( for uniform or for Gaussian). In order to calculate the probability that any number generated will fall in the range , one would take the integral . The probability to get a specific number would be which is just 0.

However, most programs and methods only allow for generation of certain probability distributions like the one mentioned above. There exists few random number generators with the distribution, for example, . Numbers with this distribution can be generated by using transformations on generated numbers. This transformation can be determined in the following way.

Assume one wishes to transform a number given from probability distribution to which has distribution over many generations of, then that means that the probability of obtaining should equal the probability of obtaining . Written using equations, this equivalence can be stated as . Integrating both sides yields . Taking the inverse function of the integral of the second distribution on both sides yields the required transformation as shown below.

The constant merely serves as a way to shift the bounds of the distribution so it could yield numbers in any range because any probability distribution needs either bounds set or a normalization factor that causes the area under the curve to be 1. This means any probability distribution can be obtained using just a uniform generator. Transforming to or from the Gaussian actually becomes complicated due to the error function (integral of Gaussian) being non-elementary (if you want to know a good method for transformation to Gaussian, look at Box-Fuller Transform). The following shows an example transformation from uniform to .

## Leave a Reply