Quantum Entropy Source
The Quantum Dice generates true random numbers using quantum-mechanical avalanche noise from a Zener diode operating in reverse-bias breakdown mode. When the diode exceeds its breakdown voltage, electrons undergo quantum tunneling and avalanche multiplication - a fundamentally random process governed by quantum mechanics rather than deterministic physics.
The analog noise signal is amplified approximately 10,000× using a dual operational amplifier, bringing the microvolt-scale quantum fluctuations into a measurable voltage range for the microcontroller's analog-to-digital converter (ADC).
Randomness Extraction & Whitening
Raw ADC samples are read with 20-microsecond spacing to de-correlate from any amplifier oscillations. The least significant bit (LSB) of each 12-bit reading is extracted as the raw entropy source, as quantum jitter is most concentrated in the LSB.
To remove any residual bias in the raw bit stream, I implemented the Von Neumann whitening algorithm:
- Consecutive raw bits are paired (b₁, b₂)
- If the pair is
01→ output bit0 - If the pair is
10→ output bit1 - If the pair is
00or11→ discard (no output)
This algorithm guarantees a perfectly unbiased output bit stream, though it discards approximately 50% of input bit pairs. The whitened bits are shifted into a 32-bit entropy pool.
Integer Generation & Debiasing
When a roll is requested, the firmware uses rejection sampling to eliminate modulo bias to ensure perfectly uniform distribution across all die faces (1 through dieMax)
Generation Time
The entropy pool continuously accumulates during normal operation. Since Von Neumann whitening discards ~50% of bit pairs, generating 32 valid bits requires approximately 64 raw bit pairs (128 ADC samples). At 20 microseconds per sample plus ADC conversion time (~10 μs), filling an empty pool takes roughly 4-5 milliseconds.
In practice, the pool is continuously replenished during idle operation, so die rolls execute near-instantaneously when the button is pressed. The visual "rolling" animation is purely aesthetic and does not reflect the actual quantum random number generation time.
From Quantum Entropy to Nixie Tubes
Once the entropy module generates a quantum random roll (1-20, 1-100, etc.), the result passes through a two-stage conversion:
Stage 1: Digit Extraction The firmware splits the result into tens and ones digits using integer division and modulo. For example, rolling a 47 becomes tens=4 and ones=7.
Stage 2: Hardware Mapping via Lookup Tables Each nixie tube has 10 cathodes (0-9), but they're wired to the display driver IC in non-sequential order based on PCB routing constraints. Two lookup tables translate logical digits into physical pin assignments.
Stage 3: SPI Communication The driver constructs a 32-bit bitmask with exactly two bits set (one for each tube's target digit), then transmits it to the Nixie tube display IC via SPI (and a level shifter) as four sequential bytes. The IC latches this data and energizes only those two cathodes, causing the corresponding numerals to glow orange through neon ionization at ~170V (powered by an on board boost converter).
The entire path, from electron tunneling event to illuminated display, completes in milliseconds, with the bulk of time spent accumulating entropy.

