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?

768 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

There are a couple levels this could be happening at.

Most basic is that you have an algorithm that is chaotic (small verieties in input produces large verieties in output) and then feed it a predetermined number. For the next number just feed the previous number in. This is good enough for a casual user but if you look closely at the data you can reverse engineer the algorithm and thus predict future “random” numbers, this is probematic if you’re trying to stop a hacker.

A more advanced way is to find a more random starting number. A general list from less random to more random is: the exact current time, the exact value of some real life sensor (CPU temperature, microphone noise, camera input etc) or a quantum random number generator. The first is very easy to implement but can be predicted with enough effort and tries. The last is absolutely impossible to predict but very costly. Most modern applications use the second since it’s almost perfect and reasonably cost effective.

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