# Random Number Generator (RNG)

## Definition - What does Random Number Generator (RNG) mean?

A random number generator (RNG) is a mathematical construct, either computational or as a hardware device, that is designed to generate a random set of numbers that should not display any distinguishable patterns in their appearance or generation, hence the word random. It is often in the form of a function or blocks of code used in software applications such as games where an element of chance is required.

## Techopedia explains Random Number Generator (RNG)

Random number generators are just the modern application of randomness devices that have existed since ancient times such as dice, shuffled cards, flipping coins and even drawing straws. In modern computing, random number generators are implemented through programming based on deterministic computation, but this is not really considered as true random because the output can actually be predicted if all seed values are known, so this is called pseudorandom number generation. However, in practice, this is sufficient to fulfill most tasks. True randomness is not really required all the time; in fact, some applications do not actually benefit from it. Consider the "random" function in a music player; it only appears random because if it is truly random it would have no restrictions on the same tracks playing two or more times in succession. There might even be algorithms put in place to control the selection process.

A true random number generator cannot rely on mathematical equations and computational algorithms to get a random number because if there is an equation involved, then it is not random. In order to get true randomness, a device must collect entropy from the natural environment to measure such as atmospheric and thermal noise and other quantum and electromagnetic phenomena. An example of a random number generator is a device that measures radio noise and then extracts that value and presents it to the user or application. Other sources of entropy include subatomic physical phenomenon such as radioactive decay whose unpredictability and randomness can be explained by laws of quantum mechanics.

Applications that benefit from true randomness are games such as those related to gambling like bingo, card games, the lottery and similar games. Video games that emphasize random loot collection also benefit from true randomness, as pseudorandom number generation can lead to frustration since it can go a long time without the target number being hit or the same number can be obtained repeatedly.