From ancient times when coins were flipped and dice rolled for gambling, people have needed random number generation. Formally defined, a random number generator is a physical or computational device which generates an array of symbols or numbers with no pattern. There has always been a large demand for random data generation from everything requiring unpredictable results, from the lottery, to computer simulations to cryptography to statistical sampling. There are two main methods of generating random numbers:

- physically

Physically-based random number generators take advantage of naturally-occurring randomization. True examples of these are difficult to find, but the most commonly-used ones are atomic or subatomic phenomena such as radioactive decay, whose randomness is guaranteed as a result of the laws of quantum mechanics. It is necessary with this method to ensure you are compensating for any biases that may occur as a result of measuring this random natural process, however.

- computationally

This method makes use of algorithms designed to produce unpredictable results by performing operations on a 'seed' key that is given as input. They are often complex, but also known as 'pseudo-random number generators' as there is a relation between the values and the seed, however distant.

As well as produce random numbers, there exists a type of tool called a randomness extractor which turns randomly-arranged data into a uniform distribution. A cryptography hash function is a good example of such a tool.