how do random numbers on computers work?

1.48K views

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

In: 47

75 Answers

Anonymous 0 Comments

True randomness doesn’t exist.

If you knew all the forces acting on a coin flip (thumb flipping power, air density, wind pressure, mass of the coin, gravitational pull of earth, moon and sun, even the pressure of photons shining on the coin and all of the othera we aren’t even aware of) you’d be able to predict the outcome with a 100% accuracy every time.

Not just a coin flip, if you knew the positions and forces acting on all of the atoms everywhere, and you could calculate how they could react from said forces in real time, you could accurately predict the future of anything really.

So in order to simulate randomness people use 2 different ways to generate random numbers on a computer.

The lazy way: They have a predetermined list of numbers that they just keep giving you the next number in line every time you ask for a random number. Sometimes they add an equation on top of the predetermined list to spice things up.

The random but not really way: Instead of using a predetermined list, they just borrow a number from a source that keeps generating different numbers. Sometimes it’s the scrambled digits of the millisecond of the moment you requested the random number, sometimes it’s the scrambled numbers of a random sensor in your pc, depends on the person who made the number generator really.

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