how do random numbers on computers work?

1.49K views

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

In: 47

75 Answers

Anonymous 0 Comments

Computers are incapable of true random, but they can fake it really well for casual purposes.

For example, you can make a “random seeming” number 0-9 number by getting the current date in milliseconds, which looks like this “1578567991011”, and grabbing the last number “1”

It’s not actually random, but it changes so fast that for human purposes (like running forecasts in excel) it replicates random well enough.

However if you need the computer to generate 1000s of random numbers at a time, patterns will emerge.

You can make it more “random” by performing further calculations. For example, you can multiply the date by the current speed of the processor, then reduce that to a single number.

The more complicated and the more data sources, the less likely that patterns emerge, preserving the randomness

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