hanoi cosmic-ray classifieds
Background reading

Cosmic ray random number generators, explained

Why muons make excellent hardware entropy, and how a coincidence detector turns one into a number.

Every random number a computer produces by software is, in a strict sense, fake. A function like rand() is deterministic. Given the same starting seed, it will produce the same sequence of numbers forever. The illusion of randomness comes from how hard it is for an attacker, or a curious observer, to guess the seed. For most use cases that is good enough. For cryptography, gambling, and any application where the cost of a predicted "random" number is high, software randomness is not enough. You need an entropy source rooted in a physical process the program cannot predict.

That is what a true or hardware random number generator does. It samples some physical phenomenon that is unpredictable from first principles, converts the measurement into bits, and feeds those bits into the system. Common physical sources include thermal noise across a resistor, avalanche noise in a Zener diode, ring oscillator jitter on a microcontroller, photon arrival times across a beam splitter, and (most famously) Cloudflare's wall of lava lamps in their San Francisco office, where a webcam captures the chaotic fluid motion as a frame-by-frame entropy source.

Cosmic ray muons are another such source. In some respects, they are the cleanest one available outside of a national laboratory.

What makes muons a good entropy source

Three properties matter:

Arrival is genuinely unpredictable. A muon hitting a square centimeter of ground at a given microsecond depends on the initial energy and angle of a cosmic ray primary that arrived from somewhere in the galaxy or beyond, possibly emitted by an event that happened billions of years ago. No computer, no model, and no observer can predict the next muon arrival from looking at the previous ones. The process is independent across measurements.

The arrival distribution is well-characterized. Background cosmic ray flux at sea level is about 1 muon per square centimeter per minute, distributed as a Poisson process. Poisson statistics are exactly what an entropy designer wants. Inter-arrival times are exponentially distributed and independent. There is no hidden periodicity. There is no exploitable correlation.

It is hard to spoof. An attacker who wants to predict or bias a muon-sourced random number would need to physically saturate the detector with a more powerful source, like a deliberately placed gamma emitter. A coincidence detector rejects single-tube false triggers, which raises the bar significantly, and a tamper-evident enclosure can detect tube manipulation. By contrast, a software PRNG can be predicted by anyone who learns the seed, and a thermal noise diode can in principle be biased by deliberately heating the resistor.

How Muon Sortes turns a muon into a random number

The mechanism is simpler than most people expect. The microcontroller runs a free-running hardware counter at its full clock rate (tens of megahertz on the ESP32-S3, which is what Muon Sortes uses). The counter is never reset, never gated, never inspected by software during normal operation. It just spins.

When a coincidence event fires, an interrupt service routine samples the counter's current value. That value, modulo whatever range the caller asked for, is the random number. The whole operation takes a few microseconds.

The key property: between any two muon arrivals, the counter has advanced through an arbitrarily large, unpredictable number of states. Even though the counter itself is purely deterministic, the time at which we sample it is not. The randomness is sourced entirely from when the sky decides to deliver the next muon, not from how the counter ticks.

Important constraint Only even moduli are used. Mapping a long binary counter to n % m introduces bias whenever m does not divide the counter range evenly. m = 8, 10, 256 are safe. m = 7 would slightly favor the lower numbers. This is a small but real detail that distinguishes a careful hardware RNG from a careless one.

How muon RNG compares to other physical sources

SourceThroughputNotes
Cosmic ray muons (coincidence) ~1 muon/min/cm² → minutes per decision Unpredictable. Tamper-resistant. Slow by design. Best for low-rate decisions, not bulk crypto.
Thermal noise (resistor + ADC) kbps to Mbps Common in microcontrollers. Fast. Susceptible to temperature manipulation.
Avalanche / Zener diode noise ~1 Mbps Dedicated TRNG ICs use this. Compact. Vulnerable to power-rail attacks if not isolated.
Ring oscillator jitter kbps Built into many SoCs. Cheap. Quality varies by silicon batch.
Lava lamps (Cloudflare wall) Continuous video stream Famous but mostly a publicity device. The cryptographic value is in the high-resolution camera noise, not the lamps.
Quantum photon split Mbps with a dedicated module The gold standard for cryptographic TRNG. Expensive. Requires optics.

Muon detection is the slowest of these by orders of magnitude. That is not a weakness for the Muon Sortes use case; it is the point. A decision oracle that waits a few seconds for the universe to reply produces something a millisecond-fast RNG cannot: ceremony. The wait itself is the experience.

Why this matters for a decision clock

The device is not solving a cryptography problem. It is solving a different problem: how to produce a number that feels meaningful. The technical case for muon-sourced RNG is that the bits are objectively unpredictable and the source is tamper-resistant. The experiential case is that every value is provably drawn from a particle that did not exist until it was made in the atmosphere by something old and fast from deep space. The clock keeps time. The sky keeps the verdict.

Reserve a numbered unit of Muon Sortes.