how do random numbers on computers work?

1.38K views

For example, is there a formula for a random number?

In: 47

75 Answers

Anonymous 0 Comments

>is there a formula for a random number?

There are many.
These formulas are known as Pseudorandom Number Generators(PRNG).
They always take in a number called a “seed” and then do math at it till it spits out seemingly random numbers.
Though a side effect of this is that if you use the same formula on the same seed, you get the same stream of seemingly random numbers.

They vary on how close to random it is, how hard it is to guess the seed given some example of the stream, and how hard it is for a computer to run.

Sometimes though they need real random numbers.
So to do that usually they need a piece of hardware that measures something physical to make up random number generators.
Random.org has some radio stuff to see what kinda random noise is coming from the atmosphere.
Cloudflare has a camera pointed to a wall of lava lamps and makes numbers from the photos.
Others use quantum mechanics stuff and other weird things.

Often these numbers will be fed into PRNG as the seed to make it even more random incase the physics stuff is somehow a little more predictable that moment.

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