Hacker News new | past | comments | ask | show | jobs | submit login
Chernobyl Dice: A quantum random number generator with a Nixie tube display (github.com/nategri)
105 points by tcberry on Dec 25, 2019 | hide | past | favorite | 31 comments



Unlike the "pseudo-random" number generators used in software everywhere, here we have a truly "random" number generator (at least with our current understanding of physics).

Impossible to predict the next number - no matter how much information about the universe you know.


If someone is building this device to protect one's private keys from the three-letter agencies, one may want to completely shield the Geiger counter and its radiation source with thick lead. Otherwise, the NSA may decide to remotely influence the behavior of the random number generator by beaming lethal level of gamma radiation toward the generator, and they would not care whether you are killed in this process. /joke


Most modern systems contain hardware RNGs that get noise from thermal effects, ultimately quantum too.


Thermal effects do not rely on quantum behaviour. They arise from an extremely large but classically deterministic state space.


Does this mean determinism is moot?


In my mind, Schrödinger's cat was an important thought experiment that pointed strongly in this direction. Whether it is just a limitation stemming from our current knowledge of physics or something else is still debatable.


In quantum mechanics, yes it is. See Bell's theorem.


And folks like Einstein felt quantum mechanics is an incomplete theory because of this. It is not an settled debate.


This is probably a dumb question, but wouldn't recording the millisecond timestamp mod 2 of each decay be a lot easier and also produce a uniform distribution (at least at the rate this thing seems to be registering decays)?


Author here.

Not a dumb question! I tried this approach using 4-microsecond ticks and was surprised to catch a (subtle) bias. So I in the end I basically used two different RNG algos (both with slight biases) and XOR’d them together.

Would love to isolate why these on their own appear to have a bias but testing is a super laborious process (takes roughly 3 days to generate a 1 megabit file).

Of course, I could always speed up the testing cycle by using a more radioactive sample ;)


That's the method described in https://arxiv.org/pdf/1604.03304.pdf on page 11:

> A fast clock (down) is used to increase a counter. Whenever a detection is made (up), the counter is read and reset, generating one random number.

> We restrict to a counter that generates values from 0 to M −1, a modulo M counter. When M = 2 we have a binary random number generator.

It doesn't have to be a millisecond timestamp, any clock that's much faster than the rate of decay should work. Every time a decay is detected, take the elapsed time in clock units mod 2 and that's your random bit.


That's a pretty unique conversation piece. The parts list and urls to supports is an image though. Oy. So maybe I can transcribe and do a pull request.


Author here.

Sorry about that! I’ll push a plaintext CSV version of the part list later today.


Looks like there's a CSV in the repo already: https://github.com/nategri/chernobyl_dice/blob/master/parts_...


Ha! Good catch


Fix line 2 by making the " denoting inches into "" and GitHub will render it nicely.


A radioactive-based random number generator surely is fun. But a friendly reminder to those readers who want a quantum device but prefer a low-power, solid-state implementation: A "quantum" random number generator doesn't always have to be fancy, it can be as boring as a diode. Diodes only allow current to flow to one direction, but if you reverse bias a diode hard enough, they'll eventually breakdown, conduct, and produce a fixed voltage drop across it. This principle is used to make voltage references and regulators. But on a closer look, the diode also produces a significant amount of random noise in this process. And the mechanisms responsible for the breakdown of a diode, either Zener Effect or Avalanche Effect, although are semi-classical, but ultimately quantum mechanical in nature - the electrons received enough energy to randomly pass through the forbidden bandgap, and the noise is effectively unpredictable. (There are also tunnel diodes that use real Quantum Tunneling, which doesn't have any classical explanation, fancier than Zener or Avalanche Effect, but general-purpose tunnel diodes are no longer in production of large quantity.)

There are some really expensive avalanche or tunnel diode noise sources you can buy, that are made by electronics giants like Keysight, that are designed to produce perfectly calibrated white noise across a few GHz of bandwidth for RF test, measurement, or cryptographic purposes. But you can build a simple one, the only problem is that the ordinary diodes are not designed to breakdown, they will, but it's thousands of volts and potentially a destructive event, thus they are not really useful. You can buy Zener diodes, but it's likely that you don't already have one and you don't want to wait for shipping. But there's another neat choice - use a transistor. The base-emitter junction of any bipolar transistor is effectively a diode for DC signals. And the most common transistors are small-signal transistors, it's easy to apply a low reverse voltage, typically 6.0 V [0] to make it go breakdown.

Then connect it to an amplifier and a ADC, you are done. And you don't even have to use an ADC, you can use a 74ALS04 logic gate (the faster, the better, 74LS is not recommended) and connect a feedback resistor to force the logic gate to work as an amplifier rather than a switch, and you get an amplified and digitized output. This idea was originally posted to the sci.crypt newsgroup. And many have built variations of this circuit with success.

Although some warned that this circuit is vulnerable to external radiofreqency interference, which can be used by the NSA to attack your generator, so good RF design practices, such as heavily shielding the noise source and the amplifier, good power supply decoupling and filtering are recommended. It's also recommended to add a builtin self-test routine to your microcontroller and disable the output in case the circuit fails the randomness check - it's an industrial standard safegaurd.

* https://www.csshl.net/sites/default/files/downloadable/hw/hw...

* https://makezine.com/projects/really-really-random-number-ge...

* http://www.cryogenius.com/hardware/rng/

On the other hand, readers who are interested in extremely fancy quantum number generators should take a look of the double-slit experiment, single-photon light sources, interferometry, and photomultiplier tubes. A simple idea would be making a single-photon light source first (e.g. adding a heavy attenuation filter in front of a dim laser, so at any time, it's very likely that only a single photon can get out on average, it's not strictly a single-photon source, but close). Then the single photon hits a beam-splitter (e.g. a half-silvered mirror), when the photon leaves the mirror, there are photomultiplier tubes working at a thousand volts and enormous gain to detect a single photon. There's a 50% chance that the photon will hit detector A, and 50% chance that it will hit detector B. Take notes of the result, and you have built an amazing quantum random number generator.

[0] e.g. See the datasheet of the 2N3904 transistor, https://www.onsemi.com/pub/Collateral/2N3903-D.PDF


You could also simply use an FM tuner and tune it in between stations for atmospheric noise. Like random.org did for a long time. [0]

Cosmic quantum noise for all your random number needs (after some filtering). Disclaimer: if you are under NSA attack you might have issues with this $5 setup.

[0] https://www.hostingadvice.com/blog/random-dot-org-true-rando...


Thanks for this interesting follow up post! :)


You mean "It's impossible to predict the bias" :)


Would the uranium marbles be at all likely to cause bit errors? Would this decrease the lifespan of the system?


Some numbers for uranium glass: https://www.orau.org/ptp/collection/consumer%20products/vase...

Doesn't answer your question, but might be a start.


Author here. Even though its proximity puts it pretty far above background, the marbles are still a fairly weak source, so from the "electronics logic longevity" side it's not something I've really thought about. But the Geiger-Muller tube does have a finite (though very large) number of events it can record, so I cut the voltage to it when the device is in "clock mode" and not functioning as an RNG.


Author should make a public API so anyone can have truly random numbers (with some trust in the author ;)


In Chernobyl you likely do not actually need to add the marbles to get the device to work.


My Geiger counter fires about once every two seconds from natural background (and would on most parts of the world due to granite, cosmic rays, radon, etc.). When I put my uranium mineral near it it goes off 600 times per second.


How does one even get uranium marbles?


Author here.

They’re not actually that radioactive so they’re very easy to get ahold of. Amazon and eBay might work (I got mine from one of those sources, I think), but I also put a more specialized supplier in the parts list.


Grab some Torbernite!


Hey whatever happened to your cat?


It got bit by a Møøse.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: