DEV Community

Discussion on: Explain how a Random number is generated Like I'm Five

Collapse
 
kspeakman profile image
Kasey Speakman

To add to what @nektro said, there are pseudorandom number generators (PRNG) and cryptographically secure RNGs (CSRNG).

The main difference being in non-CS RNGs, you can usually spot a repeating pattern. See this article. (Took me forever to find that again.)

The only way to get really random numbers is to have a random input. For instance, random.org uses atmospheric whitenoise measurements as its random input.

On computers without access to physical phenomena the OS collects whatever "noise" it has access to and uses that. For instance /dev/random on linux uses timings from device drivers, keyboard, and other stuff as its random input.