Neon Lamps Acts as RNGs for Hashing
Joshua Coleman chose neon lamp light emission as the basis for his nifty hardware random number generator.
Random number generation is a fascinating subject, because it is incredibly important for everything from proper dice rolls in gaming to cryptographic security and yet very hard to achieve. In fact, I’m not even convinced true randomness can happen, as the universe may be entirely deterministic. But we can get close enough for practical tasks through a variety of means. The means chosen by Joshua Coleman was neon lamp light emission.
A purely digital device cannot produce a random number, because any number it can come up with would be the direct result of some manipulation of knowable input numbers, which is deterministic. But if you start with an analog input, it is possible to get something that is actually random — or at least so close that nobody can prove it isn’t random.
That analog input can be almost anything that produces totally unpredictable and pattern-free variety across a target range. We’ve seen systems that use everything from radio noise to images of a bunch of lava lamps.
In this case, Coleman chose a trio of tiny neon lamps. He selected those because they seem to produce appropriately unpredictable variations in output and because they look cool.
When developing the circuits to drive the neon lamps, Coleman was careful to match their respective capacitance values. That ensures that variation between them is from randomness and not non-random electrical characteristics. A Raspberry Pi Pico W development board then measures the light output of each neon lamp using TEPT4400 sensors through its ADC (analog-to-digital converter) input pins.
From there, some fancy math happens with the readings — specifically the time intervals between discharge events. I struggled with everything after geometry and can’t explain it to you, but the basic gist is that it omits bits that aren’t appropriate and tosses the rest into a pool. When that pool of bits reaches the target size, the bits get packed into bytes and hashed as SHA-256 for use in things like encryption.
Coleman is careful to point out that this is an experiment and isn’t meant to be used for serious cryptographic applications. That’s probably wise, as the cryptography crowd gets really picky about these things — a trait I find commendable.
But it looks awesome and is certainly good enough to roll for damage in your DnD campaign, so feel free to build something similar if that’s what you’re doing.