Random Number Generator

Why Trust Techopedia

What Does Random Number Generator 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 or real money online casino slots where an element of chance is required.

Techopedia Explains Random Number Generator

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, online roulette, 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.


Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.