How do random number generators work?

274 views

How do random number generators work?

In: 119

10 Answers

Anonymous 0 Comments

For *random* numbers you start by getting a degree in math, then you argue with people who made the same investment about what “random” means.

For ordinary purposes (say a game) you want an *unpredictable* number. Back in the day we had computers with 8-bit processors and a 16-bit address space, so the maximum memory you could have, if you could afford it, was 64 kilobytes. Half of that was taken up by a BASIC interpreter. The processor ran at less than a megahertz. With precious little computing resources if you wanted a “random” number you displayed the message “Press Any Key” and started counting. The computer can count pretty high by the time the user reads the message, presses the key, and the electronics tell your code that the the key has been pressed. You stop counting and take the last few digits of the count – that number is as likely to be 37 and 74 and no one can predict it, thus it’s “random”.

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