“It was a dreary afternoon in Milan last year when, procrastinating on studying, I was struck by a flash of genius. “What would happen if I made a banana-powered random number generator?“. I immediately went to tell my roommate, who was also an electronic engineer.
He looked me in the face and burst out laughing. At that moment I realized that I had a great project in my hands.
Before being taken for a fool: it really does make sense, and this post is here to explain it to you. Let’s start at the root of the problem: computers are deterministic systems. Put in a less complicated way, if we always give them the same input data, they always return the same output values. Which is exactly what we expect from a computer. It is clear from the start, however, that determinism and randomness are not great friends. In fact, a computer, per se, is not capable of doing anything random.
If the reader is one of the lucky ones to have written some C programs, you will surely have run into some rand() function call. I myself have made extensive use of it in posts () about the calculation of pi with the Monte Carlo method.
For the uninitiated, rand() is the function that (with a lot of imagination in the name) allows you to get random numbers in a C program. But we just got done saying that there is nothing random about computers. So?
So we’ve been fooled. Unfortunately, friends, we’ve all been fooled. I take my share of responsibility, too, for flippantly calling them random numbers in posts about Pi. We should have called them pseudo-random numbers. Which is the name computer scientists give to those sets of numbers that have the distribution in line with random numbers, but which are not actually random.
To understand it better, to be called random, a set of numbers must have at least (a necessary but not sufficient condition) these two characteristics:
Each number must have the same probability as every other number to appear in our list (taken a reference interval). This is what we call uniform distribution;
The sequence of numbers must not be predictable in advance.
Clearly, the difficulty with deterministic machines is in answering point 2. Point 1 is easily solved, and gives rise to what we have just called pseudo-random numbers. Numbers which respect the uniform distribution, but which are not actually truly random.
But what do bananas have to do with anything?!
Now we are getting there!
When you need to provide a computer with true random numbers, you use hardware systems, called true random number generators (TRNG). There are many types of TRNG, which exploit different physical random quantities and convert them into digital information that is passed to the computer.
The most common ones exploit physical phenomena such as thermal noise of resistors, the avalanche effect of diodes and other chaotic effects. Others exploit more complex quantum phenomena such as shot noise, radioactive decay or photonic effects.
The possible way using bananas is that of radioactive decay. Bananas in fact are known to contain a lot of potassium, and a small but significant percentage of the potassium present in nature is radioactive. Specifically we are talking about the 40K isotope, which makes up 0.01% of potassium in nature. Plus they’re delicious with lemon and sugar, which alone would be a great reason to always have one on hand.”