[It slightly bothers me that the last few posts are mostly MineCraft-related. But as Leo has been getting more and more interested in nuances of MineCraft, I’m trying to guide this interest toward math instead of evil. (And “evil” in MineCraft is quite a lot less evil than with many other things he could be getting addicted to.) (Some day I’ll talk about MineCraft addiction management strategies … when I figure some out!)]
One of the (many) good things about MineCraft is its programmability, which I’ve mentioned before. But there’s even a simpler sense in which it’s sort of programmable, which is that you can set the randomization seed when you create a world. Leo got into this because one of the other good things about MineCraft is that there is a community, even at Leo’s age, of kids (of many ages!) who have explored a huge amount about the world, so he learns from his friends, and also from the web, about many cool worlds that have been discovered using various seeds. Here’s an example, but there are literally hundreds (maybe thousands!) of these!
Interestingly, in MineCraft, the term “seed” makes for a convenient pun; Leo understood perfectly that the “seed” is what the world is grown from. But in reality, of course, it comes from the concept of a random number seed, which is how the pseudo-random number generator creates the random stream that generates the world, and everything in it. This, of course, is how it’s possible to publish the seed, as in the web page above, so that others can get back to the same exact (initial) world.
So I turned this into a series of discussion about random numbers, pseudo-random numbers, determinism and non-determinism, and one of Leo’s favorite topics: Quantum Computing and cryptography.
Here are the blackboards that I used in these discussion, with some (too brief) commentary. I strongly recommend this video for a really well done explanation of the whole conceptual space (except for the quantum computers).
Let’s start with determinism v. non-determinism:
Leo got right away that 4+5 is deterministic, and if you were to print the result in a loop (bottom right scribble) you’d get 9 every time, but 4+Rand(10) would randomly give you a number between 5 and 14 (in 1-origin). Note, also at the bottom left the important observation that “All non-quantum computers are DETERMINISTIC.”
So, the mystery is:
To translate my scribbles:
- All (non-quantum) computers are deterministic.
- Rand(#) [which is a computer function] seems to be non-deterministic. (We tried this on the iPad in the BASIC interpreter.)
- The mystery (apparent paradox!) is: How does Rand work? (We had a brief passing philosophical discussion about paradox v. conundrum.)
The answer, of course, is:
PSEUDO-RANDOMIZATION – Ensued a long interesting discussion of possible pseudo-randomization algorithms, the meaning of “Mod” (the modulo wheel at the bottom center), and so forth. (This board had lots of erasures; You’re only seeing the end product!)
The key concept, which closes the loop on MineCraft seeds, is that the computer needs to have something external in order to seed the pseudo-randomization. That’s what the box around MineCraft is. We talked a lot about where the computer could get a seed. One place is obviously that you give it a specific seed. In that case what’s external is you! But what about when you don’t give it a seed? (Leo’s initial solution, of course, was to use Rand() … 🙂
After explaining why this wasn’t going to work (can you say: “infinite regress”?) And that quantum fluctuations were going to be hard to capture [see footnote 1 below], I posed the following problem: Suppose that you were locked in the kitchen with all the lights off at night (we actually did this exercise), and needed a pseudo-random seed…. It only took a few seconds to get the right answer to this one:
Footnote 1 (20181107): It turns out that early random seeds were, indeed, generated from macroscopic quantum fluctuations, and more recently, believe it or not, from cameras aimed at a bank of lava lamps! Here’s a terrific video on these.