Institute of Mathematics > Mathematics interactive > Simulation > Generating of uniformly distributed random numbers

Generating of uniformly distributed random numbers

For performing stochastic simulations random numbers that are distributed in accordance with certain probability distributions are needed. These random numbers are obtained by various distribution-dependent methods from random numbers that are uniformly distributed on the interval [0,1].

In general no truly random numbers can be generated by a deterministic working computer, but only pseudo-random numbers. These peudo-random numbers are indeed nearly uniformly distributed on the interval [0,1] and meet a number of criteria for real random numbers, but still have some regularities real random numbers do not have. For applications in cryptography, it is important that these regularities are minimal and in particular can not be used to calculate the next pseudo-random number from a number of pseudo-random numbers. For application in stochastic simulation these strong conditions are not needed, so here come often linear congruence generators are used for generating random numbers.

In a linear congruence generator the each next random number (an+1) is obtained from the previous one, by multipling the last value by a fixed number (b) and then adding an also fixed number (c). Finally, the result is considered modulo also fixed number (m). Thus, a distribution between 0 and 1 results, if the obtained numbers are divided by the selected module:

a0:=Initial value
an+1:=b⋅an+c mod m
Random number: un:=an/m

The quality of the random numbers, that is, how well the resulting values un form a uniform distribution on [0,1], depends on the choice of b, c and m.

an+1 :=  · an +   mod 
a0 :=

Sitemap  Contact  Data Privacy  Imprint
© TU Clausthal 2022