Hacker News new | past | comments | ask | show | jobs | submit login
Generating true random numbers from bananas (valerionappi.it)
101 points by em3rgent0rdr on June 12, 2022 | hide | past | favorite | 57 comments



I tried seeding a random number generator with a banana, but the banana was seedless.


Bananas are as far from random as possible already: they are all clones! (The widely available Cavendish banana)


And each an every plant susceptible to the same strain of the same disease: https://en.wikipedia.org/wiki/Panama_disease.


Pet peeve: contrary to popular belief bananas are not actually a high potassium food. They are not even in the top 10! Leafy greens contain way more potassium than bananas do: https://www.sharp.com/health-news/where-to-find-potassium-ot...


But this is measured by cup for many of the items on the list. E.g. Avocado is #3 but I would not eat a cup of Avocado per day. I do eat a banana most days. And I eat half an avocado, which weighs in the order of a 10th of the weight listed for a cup.


Did he actually say how the data is gathered? It hinted at potassium decay but if he went into more detail, I missed it. And every experiment needs a control - does the banana add anything?


Author here. There is a part 2 that explains the generation in detail, you find it linked below the part 1, or at the link [0]. The banana does not make a significant difference (the generator can operate without it), however the potassium in general can definitely be detected. I've made some test with KCl and the increase in counts is huge. In the end this is not very important for the purpose of the project: i just wanted to tell a story involving true random number generation from radioactivity, and the radioactive banana is very functional for this purpose.

[0]: https://www.valerionappi.it/chi-squared/


The detector is a Geiger tube. There are more details on the GitHub page [0], including this note:

> Disclaimer: the radioactivity from the bananas doesn't quite make the difference, the background radiation is more than enough to make the generator work and afaik the banana's is not even detectable.

[0] https://github.com/valerionew/Banana-Random-Number-Generator


> afaik the banana's is not even detectable

So they might just as well have used salt? AFAIK that is best practice. :)


Potassium Chloride is sold as a sodium-free table salt substitute and will give you far more decay events per second than a banana. I'd have to double check the decay rate in a kilo of KCl vs background radiation, but even if the decay rate is too low for random number generation you can still use it to salt your hashes[0].

[0] https://www.allrecipes.com/gallery/best-hash-recipes/


KCl is definitely detectable. And the same goes for KOH. And it significantly increases the throughput.


>you can still use it to salt your hashes

Nice.


I would recommend looking at David Johnston's book "Random Number Generators, Principles and Practices" to get a handle on how complicated evaluating RNGs properly is. Radioactive sources combined with conventional circuits/electronics are too slow for practical applications afaik (e.g. incredibly time consuming to prove the performance but not bad in principle). However, I love the banana idea for its inventiveness.


For broadband white-noise I really like to utilize the avalanche breakdown noise which you can get from reverse biased zener diodes.

I didn't use it for TRNG but for measurement and it really gives you a nice straight noise spectrum from 10Hz to above 100kHz.

Things that could be relevant for TRNGs: http://www.reallyreallyrandom.com/zener/why-its-random/


Definitely a slow method! It outputs about 1 byte every second. Not great performance! This 22KB sample took several hours to collect: https://github.com/valerionew/Banana-Random-Number-Generator...


Wouldn't it be possible to build large detectors of reasonable cost and power consumption? For example, instead of a small tube like in the article, flat metal plates or arrays of long wires in a thin rectangular chamber.


The throughput is given by the frequency of the radioactive events. This can easily made bigger with a more radioactive source. The limit in this is how fast is the underlying reference timer. If you could have a fast enough timer, you could raise the radioactivity of the source and get a bigger throughput.


I wouldn't be comfortable putting the kind of strong radiation source that can increase events by some orders of magnitude close to me or my computers. Large detectors or multiple detectors to catch more natural radiation are safer.


Yep but the main point that i was trying to make is that to get a faster generator you need a faster clock and a bigger timer, not a bigger detector nor more events, if you cannot back them up with the faster clock and bigger timer


> Radioactive sources combined with conventional circuits/electronics are too slow

That’s the case with bananas, but would a lump of weapons-grade uranium provide enough randomness to be useful?


An alternative approach would be:

    1. put a banana on a dish
    2. wait for fruit flies
    3. point camera on the banana
    4. take images
    5. compute SHA256 checksum
    6. use checksum as the random number


Related: upcycling an expired smoke detector's ionisation chamber into a Quantum Random Number Generator [1]. I don't see a schematic unfortunately. Make sure to read the comments section about using single versus pairs of decay events in the thread that Don Froula started.

I fantasize about collecting all the ionisation chambers being tossed in my city and first rigging up a massive Redundant Array of Inexpensive RNG's out of them, then upcycling them into home-based RNG appliances to sell to people to plug in that hand out hotbits over the wire, public and private WiFi and Bluetooth to create a mesh of hotbits anywhere you walk around to grab through a protocol that mixes hotbits from these appliances and public RAIR's. Then we could be awash in randomness data to use anytime we wanted, from a highly-distributed mesh.

[1] https://hackaday.io/project/180445-qrng


Kind of like a distributed league of entropy? Seems a bit impractical and overkill, but also extremely awesome.

Maybe we could somehow get a Bluetooth broadcast data manufacturer code reserved for just spewing randomness.

Not at all secure, but if you mix it with a good mixer it can't hurt, and it can't be hacked by anyone out of state, or out of the 800ft range if they lack a giant antenna.

Maybe a really simple network random protocol could be defined. Just a UDP packet where you send N bytes of entropy, the receiver mixes it in their state, and sends you back N bytes. Randomly once every 60 minutes you multicast 32 bytes.

I'd prefer as few americium sources around as absolutely needed for fire safety though, but maybe it's better than where they normally go(The trash, I'd imagine, whether or not that's legal). Maybe half silvered mirrors and avalanche diodes?

Raw unprocessed live quantum bits as a service are pretty cool for non-security related things too.


I think the phrase "true random" is confusing. The author did highlight the difference well between the two. I still wish there was a better phrase for techniques generating randomness that are currently better than techniques generating pseudo-randomness.


Yes, its essentially nonsense and seems to come from some quarters of the academic community as well as a marketing/differentiation technique. In reality there are:

PRNGs - pseudo /deterministic, CSPRNGs - crypto secure pseudo /deterministic, HRNGs - hardware based (this can refer to anything from roulette tables to zener diode noise), QRNGs - where the entropy source is quantum mechnical in nature.


Nothing is truly random. Radioactive decay for example is influenced by the Purcell effect [1].

[1] - https://en.wikipedia.org/wiki/Purcell_effect


Under very specific circumstances:

>The radiative properties of an atom in a cavity differ fundamentally from the atom's radiative properties in free space. Spontaneous emission is inhibited if the cavity has characteristic dimensions which are small compared to the radiation wavelength, and enhanced if the cavity is resonant. The cavity causes slight shifts in the energies of the atom, analogous to radiative shifts. [0]

I wouldn't classify it under radioactive decay as in "nuclear change" (here: Potassium-40 as beta minus decay and EC, respectively) as it is a well understood photon-matter-interaction phenomenona (cQED) in e.g. manipulating single photons (single atoms in cavity) deterministically [1] which can be used in turn - coincidentally - in generating true random numbers ... [2]

[0]https://ui.adsabs.harvard.edu/abs/1981PhRvL..47..233K/abstra...

[1]https://www.nature.com/articles/nphys569

[2]https://aip.scitation.org/doi/10.1063/1.3610677


Ideally I would love if we could stop using "random" entirely when referring to PRNGs. Call them "deterministic bit mixers" or something.


We can just call them CSPRNGs to be precise.

The pseudo lets you know it's not real quantum randomness, and the rest of it lets you know it's probably good enough for all practical purposes.

Actually, crypto pseudorandoness can be more appropriate for some things, because you can prove you didn't rig it.


"Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin." -- Von Neumann

Lots of sinners in tech and academia...


I don't think that adds any value over pseudo-random.


perhaps "non-psuedo-random" ? or physically-random, as in, produced by an effect of physics and not an algorithm.


I think "non-psuedo-random" is definitely better for someone approaching the topic from a beginner mindset. It possibly hints that something non-psuedo-random can become psuedo-random depending on how advanced scientific understanding of nature becomes.


pseudo*

pseudo*

pseudo*


I'm more of a descriptivist myself


And I like describing the proper spelling of words :P


What are the cryptographic and other such applications today for which `/dev/urandom` is not good enough and atomic decay randomness as a source is required opposed to thermal noise?


None. There's no evidence that radioactive decay or other quantum processes are any more random than deterministic chaotic processes like thermal noise.


Absolutely 100% no advantage whatsoever.

Absolutely 100% more fun.


Only recently learned about the radioactivity of bananas - in a GCSE physics past paper I was helping my son with the other day, one of the questions concerned using the Banana Equivalent Dose (https://en.wikipedia.org/wiki/Banana_equivalent_dose) as a whimsical but more human-meaningful unit of (ionizing) radiation exposure.


To borrow an adage, the random numbers decide nothing, it is who counts and samples the entropy that decides everything.


Could we also make a true random from bananas by just extrapolating the coloration patterns and distribution from a picture? It isn't quantum based randomness, but its either a good source of randomness or we find some weird patterns in banana riping process, so a win win ...


That's what I expected from the title, use properties of the banana to extract 'random numbers', and provide new bananas to get a pool.


Who would have ever thought the Atheist's Nightmare would have so many other uses?

https://www.youtube.com/watch?v=Y4yBvvGi_2A


The whole contraption should be shielded from the environment, otherwise its output could be easily influenced by an outside adversary pointing X-ray gun at it.


Didn't we agree on the fact that if an attacker gains physical access the security is already compromised?

Otherwise you could just inject whatever you want from the uart, no need for any x-ray gun.


Without shielding you don't need physical access, just physical proximity.


Fair point.

However I don't think you'd be able to easily manipulate the random stream.

By triggering the random tube you just generate a random number, but even by triggering it continuously you cannot directly manipulate the bytes. The counter is not reset after every event.

Moreover: the timer/counter is clocked at 20M, for a 16 bit timer it overflows every 3ms. The tube is inhibited for a similar amount of time by a monostable 555. And this inhibit time is controlled by an RC network that is separated from the timer/counter crystal. So even noise and fluctuation on this two clock sources generate some randomness.

I'm not saying that it is impossible to manipulate, I'm saying congrats if you figure out a way.


A Geiger-Müller tube has a dead-time after a detection event where it won't register a new event. Thus it's possible to saturate the tube. This would drastically reduce the entropy it generates, from what I can gather.


I should try and see. The inhibit from the monostable timer could somewhat "transfer" the randomness source from the geiger to the time constant of the 555


I don't agree that uniform distribution is required for randomness.


Me neither, and I'm the author. But whatever.


Well that's interesting. Thanks for responding to my post. If you agree with me, why did you name uniform distribution as requirement number 1? Is that just part of the "official" academic definition or something?


I am not able to motivate further, it's just that usually when we talk about random numbers we mean uniformly distributed random numbers. It is not a requirement in a strict sense. It's just the easier way to tell about randomness. We all have an intuitive understanding of rolling a dice or flipping a coin.


As a fun example, I used to run load tests for several systems using random numbers distributed under a power law.


The first thought that occurred to me was, I wonder if the radioactivity changes as the banana ripens. The starch converts to sugar, but of course that has nothing to do with the amount of potassium in the banana... or does it?

Perhaps geiger counters in the hands of hobbyists could perform experiments confirming or disproving the theory of biological transmutation - the possibility that life can transmute sodium to potassium or potassium to calcium has been totally written off by modern physics, but only declared impossible, not proven to be bunk. The talk page on Corentin Louis Kervran's wiki [0] is more interesting than most psuedoscience, and a book review [1] describes some compelling experiments:

> Everything they ate and drank was measured and everything they excreted was measured, weighed and reported. The balance sheet showed that during great heat the potassium excreted through perspiration greatly increased. The workers were given salt tablets to suck on during the day to increase their sodium. More potassium was excreted than the workers were consuming.

> Hens without calcium in their diets can transmute mica which contains some silicate of potassium to calcium in less than a day going from soft shells to hard, complete shells in 20 hours.

Should be pretty easy to prove with some geiger readings over time, no?

[0] https://en.wikipedia.org/wiki/Talk:Corentin_Louis_Kervran

[1] https://bionutrient.net/site/library/reviews/biological-tran...


> More potassium was excreted than the workers were consuming.

This part is not necessarily surprising - K and Na perform similar roles in the organism in certain areas, so it's possible that the body was shedding its reserves of K preferring to replace them with the Na it was receiving.

That seems just a little bit more likely than expecting the body was actually fusing Na with ? to produce K.

> Hens without calcium in their diets can transmute mica which contains some silicate of potassium to calcium in less than a day going from soft shells to hard, complete shells in 20 hours.

Again, the most plausible explanation by far (well, except for experimental error) is that the potassium supplements enabled the hen's bodies to replace some amount of Ca with K in one process where they work similarly, freeing up the Ca for another place where they don't. This is even easier to imagine, as the body has enormous reserves of Ca in the forms of bones, which it can and does occasionally dissolve and re-use (that is why severe malnutrition can lead to bone brittleness even in adults with fully formed bones).

> only declared impossible, not proven to be bunk

This is a misunderstanding. The modern understanding of the structure of the atomic nucleus (based on quantum chromodynamics) proves that any change in the atomic number must be accompanied by a gigantic amount of energy, as the bonds holding protons together are extraordinarily strong (they are held together by strong force interactions between their constituent quarks).




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: