how do random numbers on computers work?

1.54K views

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

In: 47

75 Answers

Anonymous 0 Comments

They don’t. Computers can’t be random. But they can be pseudorandom. So random enough to look random to a casual observer. Generally they do this by incorporating something non-computery, like a human.

So for example, let’s say you need a number from 1-100 at random. What it could do is be constantly counting from 1-100 in the background. When you ask it for a number it stops and gives you whatever it’s landed on. So to a human it looks random. Obviously there are other methods, that’s one hypothetical example. A lot of devices use the device’s clock to get something random. That’s just one way you could use human interaction to have a computer generate a “random” number.

Because computers aren’t random, if you know exactly what they’re doing, they can be manipulated. High-level Pokémon speedrunners actually learn how to manipulate the game’s randomness to get the results they want.

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