Read more: https://engineering.mit.edu/engage/ask-an-engineer/can-a-computer-generate-a-truly-random-number/

# TIL that a computer cannot generate truly random numbers. While the pattern of computer-generated “random” numbers can be sufficiently complex and difficult to identify, these numbers are created by a carefully defined and consistently repeated algorithm; hence, “pseudo-random” numbers are produced.

## 9 Comments

Leave a Reply## Leave a Reply

You must be logged in to post a comment.

Bonus fact: computers can produce truly random numbers by observing the world around them.

One really simple way (albeit somewhat inconvenient) to do this is by setting up a bunch of lava lamps and using a photo of them as the seed for your random number generator. Alternatively, the quantum state of a radio signal can be read after having passed through the atmosphere, making it as chaotically random as weather itself.

Nitpick (because one needs to be nitpicky when talking about computers, and the linked article is over 10 years old, which is an eternity in that field): a computer can most definitely generate truly random numbers. This is commonly done by using thermal noise in the CPU as a source of entropy, e.g. [https://en.wikipedia.org/wiki/RDRAND](https://en.wikipedia.org/wiki/RDRAND)

The pseudo random number generators you are referring to are indeed predictable in their most basic form, but modern implementations will feed additional entropy into those generators to make them unpredictable again, even on older hardware lacking a true random noise source. Such entropy might be obtained from things like network traffic or mouse movements.

A cpu, without external sensors, can’t produce true randomness.

A computer can though, because computers usually have ways to measure real world data in subtle ways, and those can be used to produce true randomness.

.. I’m leaving aside the whole free will vs determinism vs true randomness debate here.

Your source actually says:

> There are ways that machines can generate truly random numbers.

Not just computers. There is no randomness anywhere in nature.

It’s all deterministic chaos.

“random” numbers might be generated with dates and times. One example i can give is this. A computer is tasked with generating a random number. So it takes the digit at the top of the hour and multiplies it by the amount of time the computer has been powered on in seconds. Then it divides it by the the digit of the month (12 for december, 3 for March, etc). The result is your random number. If you only asked for a 2 digit number (10,20,30,etc) and the generated number is longer, it will slice off the remaining digits at the front or the back depending if the date is even or odd. While very hard to guess as the parameters for generating are changing every second, it is theoretically possible to find the exact number that will be generated. You would need to know the order things were executed and the exact time the number was requested to do so in this case, so it’s incredibly unlikely you’ll be able to figure it out and thus appears random to the end user.

With this thought in mind, easier to win the lottery if you know this patterns? Or have a logic behind them?

Is it? As a programmer myself I could create an algorythm that could give a random number in response.

Can anyone educate me? Is it not easy?

This is what it’s hard for me to trust the truly random nature of any video game casino machine or slot machine in general.