## Archive for March 9, 2012

### Random Number Generation

While playing Nurikabe, my sons completed the following puzzle:

The puzzle itself isn’t very interesting, but did you notice the Puzzle ID? Exactly 1,000,000. The boys thought this was pretty cool, and I did, too. Yeah, yeah, I know, the occurrence of 1,000,000 shouldn’t impress me more than the appearance of, say, 8,398,176 or 3,763,985. But there are just under 10,000,000 unique 5 × 5 puzzles on the site, and only nine of them contain six 0′s. How lucky were we to get that random number?

Generating random numbers can be a difficult proposition, especially for a computer. This article from WIRED magazine — which describes a pattern that inadvertently appeared on lottery tickets, making it possible to predict winning tickets before they were scratched — shows how difficult it can be to generate numbers that appear to be random. (The article really is worth a read, especially for math geeks. Truth be known, WIRED is the only magazine that I read cover-to-cover every month.)

Robert Coveyou, a mathematician who worked on the Manhattan project, was an expert in pseudo-random number generators. He is most famously remembered for the following quote:

The generation of random numbers is too important to be left to chance.

Of course, Randall Munroe at xkcd has a foolproof method for generating a random number:

I would hate for you to need a random number and then have difficulty generating one. I’m here to help, so I present the…

**MJ4MF Random Number Generator (PDF)**

Creating the MJ4MF RNG is quite simple. Just follow these steps:

- Download and print the PDF from the link above.
- Cut out all six squares, one for each number 1-6.
- For each square, make two folds: first, fold the paper to the center vertically; then, fold the paper to the center horizontally. The result of these two folds is shown, below left.
- When all six pieces are folded, interlace them to form a cube. This is shown, below middle. The assembled cube is shown, below right.

Finally, a joke about random numbers.

A student is asked for the probability that a random number chosen between 0 and 1 will be greater than 2/3. The student answers 1/3. The teacher says, “Great! Can you explain to the class how you arrived at your answer?” The student says, “There are three possibilities: the number is either less than, equal to, or greater than 2/3, so the probability is 1/3!”