October 2025
Intermediate to advanced
485 pages
13h 2m
English
If you’ve used Python, or any high-level programming language for that matter, it’s easy to take for granted that you can use it to generate random numbers. For example, you can print a random integer from 1 through 10 with the following snippet:
| | import random |
| | |
| | print(random.randint(1, 10)) |
But here’s a fundamental, almost philosophical, question: how can a computer choose a random number? Here’s what I mean.
Let’s talk about randomness as it appears in the world. If I ask my friend to choose a random number between 1 and 10, is the number they choose truly random? Perhaps there’s some psychology involved in the number they choose. In fact, some studies show that people choose 7 more often than any other number. ...
Read now
Unlock full access