# Random number generator

A **random number generator** picks numbers at chance from a distribution.

The most common type is a *uniform generator*, where each number has an equal chance. If a uniform generator yields decimal digits from 0 to 9, then each digit has a 10% chance. The other type is a *weighted* or *biased* generator, where the chances are not equal. A biased generator that yields 0 with 70% chance, yields 1 with 30% chance, would probably yield more zeros than ones.

*True random numbers* are impossible to predict. Many programs use *pseudorandom numbers*, which are not as good. A pseudorandom generator uses a formula and a state to calculate a sequence of numbers. Anyone who knows the formula and the state can predict those numbers.

Pseudorandom numbers can also have statistical problems. True random numbers are independent. A pseudorandom sequence may contain patterns where the values of some numbers change the probabilities of other numbers.

See also Pick_random_element.

## Tasks[edit]

- Random number generator (included)
- Random number generator (device)
- Everything in Category:Randomness

## Links[edit]

- Wikipedia's article about Random number generation
- NIST's statistical tests for random numbers