Skip to content
loading...
markdown guide
 

Why true random number can't be generated?

Because computers are designed solely to do simple task over and over again in a very predictable matter. But that's exactly the problem. It's not random if it predictable.

What we make instead is called a pseudorandom number generator. These are wild algorithms that generate "random" outputs. However, they are still algorithms and with the same input will always have the same output. To combat this, many PRNGs "seed" the algorithm with almost unpredictable data like the time or the angle of the device from the gyro.


Quantum processors bring about the potential for "truly" random number generators, but we don't really know because we don't know a lot about quantum physics, and it depends on the knowability of sub-atomic information.

 

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.

Classic DEV Post from Feb 26

BaseCS: Tree Traversal

We'll learn about what it means to search through a tree, and see how the order of traversal through a tree can change the way that we visit every node in the data structure.

Saurabh Sharma profile image
Web development | #javaScript #css #reactjs

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️