How does a computer program generate random numbers? Example: when you ask Siri to give you a random number between 1 to 10, how does it come up with that number?

760 viewsMathematicsOther

How does a computer program generate random numbers? Example: when you ask Siri to give you a random number between 1 to 10, how does it come up with that number?

In: Mathematics

18 Answers

Anonymous 0 Comments

Computers are generally pretty terrible at coming up with truly random data; this is a consequence of the fact that they operate on known inputs in known programmatic ways.

When you talk about randomness in the context of computers, then, what you’re mostly always talking about is something called “pseudo-randomness” — output that appears “close enough” to truly random for most purposes.

Pseudo-random number generators (PRNGs) perform one or more mathematical operations on a number, then return that result, as well as *using* that result as the starting value for the next “random” number. Depending on the complexity of the operations and how they’re chained together, you can get a pretty random-seeming sequence, but make no mistake; they *aren’t* random.

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