Close

Part 4 - Still Random

A project log for “Atomic” Clock

Experiment in non-oscillatory timekeeping - trying to tell the time with a rock and a Geiger counter.

alnwlsnalnwlsn 07/26/2025 at 16:230 Comments

This might be the only clock out there that produces random numbers as a byproduct of its operation. You know, just to remind you that radiation is a truly random event.

How it does so is exactly the same way John Walker's famous HotBits project worked, and relies on the fact that no one knows exactly when an atom will decay. Walker used a commercial sample of Cesium-137 with a half life of 30 years, and it turns out a rock with a billion year half life works a lot slower. Walker claimed to get 100 bytes per second with his setup; mine gets more like 30 bytes per minute.

Consider how rare it is for a single atom of U-238 to decay. Suppose that you have one on your desk, and you watch it for a year. What is the chance that in that year, you will see it decay? In fact, you actually have a better chance of walking into a casino, putting a $1 bet down at the roulette table, making a series of consecutive winning bets, and walking away a billionaire. Again, if you're handed any old atom, it's decay date is completely random. It could decay 4 minutes from now, or in 30 billion years. The really bizarre thing is that if you are handed two atoms, one produced yesterday in a reactor, and one known to be 10 billion years old already, you can't even say which one is likely to decay before the other, in the same way you still can't predict a fair coin is "about to" come up tails even if it just flipped heads five times in a row. But the thing is, if you remember the number 6.02x10^23 from chemistry class, then even a few grams of something contains many million trillion atoms, so there are plenty of them decaying right just now at any given time regardless. Of those, their decay particles will travel in a random direction, so some will fly away from the geiger tube, and some will intersect the tube but not get detected. Some others will be detected by the diode geiger counter instead. But even with all that, this happens often enough that the tube detects something more than 60 times per second.

To use this to make random numbers, whenever the interrupt fires from a radiation click, you make note of the value of a running timer - I'm using the arduino micros(). Do this 4 times, and it will give you two completely separate and isolated intervals of time. If interval A is longer than interval B, that's a 1, and opposite that for a zero. The collected bits are then packed into bytes, and when I've collected a buffer of 32 of them, I have the Pi Pico W send out an MQTT message. Then, a listener program collects this and stores it on disk. I didn't quite know what to do with the random number after collecting them, so I decided to publish them to my website. This is done whenever I collect 1K of random data, which happens about every half hour. The random data from the tube counter actually uses every 2nd tick of the interrupt, to better match the rate of random data that comes from the diode counter. In hindsight, I'd rather have had the tube run at its full rate, but doing so now would interrupt the experiment.

I've collected around 16Mb of random data. How random is it? Walker's own ENT utility gives this report for the tube:

Entropy = 7.999983 bits per byte.

Optimum compression would reduce the size
of this 10896448 byte file by 0 percent.

Chi square distribution for 10896448 samples is 252.14, and randomly
would exceed this value 53.88 percent of the times.

Arithmetic mean value of data bytes is 127.5498 (127.5 = random).
Monte Carlo value for Pi is 3.140889633 (error 0.02 percent).
Serial correlation coefficient is 0.000394 (totally uncorrelated = 0.0).

And for the diode:

Entropy = 7.999962 bits per byte.

Optimum compression would reduce the size
of this 4998304 byte file by 0 percent.

Chi square distribution for 4998304 samples is 261.52, and randomly
would exceed this value 37.61 percent of the times.

Arithmetic mean value of data bytes is 127.4593 (127.5 = random).
Monte Carlo value for Pi is 3.142226757 (error 0.02 percent).
Serial correlation coefficient is 0.001270 (totally uncorrelated = 0.0).

...which seems roughly on par with HotBits.

Discussions