how do random numbers on computers work?

1.53K views

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

In: 47

75 Answers

Anonymous 0 Comments

In the context of most computing applications, “random” is just another word for “unpredictable”. You just want to generate a number that can’t be easily predicted by anyone. Of course, there are different levels of unpredictability. If you simply use a mathematical formula that generates a chaotic series of numbers, then all someone would need is that formula to predict the numbers that are to be generated. If instead you use the 4th decimal point of the temperature of your CPU in Kelvin, divided by the ASCII code for the first character of Elon Musk’s latest tweet, multiplied by the distance between two GPS-tagged blue whales, divided by the real-time airspeed velocity of an unladen swallow… well, you’ll get a much less predictable number.

But these are all still considered pseudo-random, because with enough information, you could still predict the next number. A truly random number would be one that no one could ever predict, no matter how much information they had about the current state of the universe. Basically, a number that God can’t predict. Determining whether it’s possible to generate a truly random number becomes more of a philosophical argument about determinism than a mathematical problem.

But for computer applications, as long as a number is sufficiently unpredictable for its application, then it’s considered random “enough”. Obviously, if you’re generating encryption keys for top secret military communications, you’ll probably want a less predictable random number generator than if you’re generating random numbers for a freeware slot machine app.

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