how do random numbers on computers work?

1.45K views

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

In: 47

75 Answers

Anonymous 0 Comments

True randomness is not possible. In short, yes there’s a function that if you know all the inputs, you can predict the outcome.

But it can get ridiculous. It might be take the date time down to the millisecond. Convert it all to numbers. Multiply it by 12345678987654321 and then take every other digit as your output. So if you ask for a random number at a known time then you can do the math and figure out the output. But otherwise it might as well be random.

It doesn’t have to be time. It could be whatever your current IP is or the file path of the last opened file. Or literally anything could be used to insert “randomness” into the formula.

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