ELi5 , how do random number generators work?

735 views

How is it different than the program just choosing the number it wants within range?

In: 6

11 Answers

Anonymous 0 Comments

There’s pseudo-random numbers, aka a computer program starting from an initial seed (usually, the time indicated by the system clock). This seed works as “source of randomness” Basically, the program takes the seed as an input, does some calculation and outputs a number that will, for some purposes, be random enough to be used. There are other sources of randomness, like using the sound picked up by the computer microphone.

For some applications where it is of critical importance that the pseudo-random numbers cannot be guessed in advance, not all sources of randomness are suitable, because some are predictable. For example in online betting games with money at stake, you wouldn’t want a player to be able to predict which random numbers are going to come up, based on which ones already came up during the course of a game. The same kind of problem might arise as well in some scientific applications, for example maybe the Monte-Carlo algorithm (an algorithm that finds zeros of a function by resorting to randomness).

Hence, for such applications, you need to make sure that your source of randomness is suitable. Suitable might mean “one cannot predict which number will come up next” for online betting games”, or it might mean that the statistical distribution of a large amount of these numbers, follow some properties that are convenient for scientific applications.

There are sources of randomness that are, from my understanding, better than the basic “microphone sound” or “system clock” ones. One example is [random.org](https://random.org), a website that gives you pseudo-random numbers that it has generated using atmospheric noise as a source of randomness. Interestingly enough, this website mentions on its main page that its pseudo-random numbers are being used for lotteries, online games, and scientific applications.

You are viewing 1 out of 11 answers, click here to view all answers.