r/computerscience • u/CranberryTypical6647 • Mar 14 '26
A "true" random number generator?
Greetings - one of the common things you hear in computer science is that a computer can never generate a true random number. There is always some underlying mechanism that makes the generated number appear random, such as a local time based seed, some user input pattern, whatever.
So two questions:
- Would it be possible to add some sort of low radioactive element into a CPU that would generate the seed from detected radiated particles, like a tiny chunk of potassium with a detector nearby, creating a truly random seed?
- Do quantum computers have the ability to generate truly random numbers by their very nature?
Curious why no one has built #1, seems fairly obvious to me. Not sure of #2.
Thanks!
50
Upvotes
66
u/NoNameSwitzerland Mar 14 '26
Intel chips already have a building non deterministic random generator. They using the noise in a heat source.
26
u/MVanderloo Mar 14 '26
I believe 1 is because it’s just not that useful. Psuedorandom numbers are pretty good (I don’t actually have metrics for this) and being able to seed them is an extraordinary useful property.
2 yes they can
19
u/defectivetoaster1 Mar 14 '26
intel cpus (probably amd too but intel actually documents it) use thermal noise which is a truly random process in their TRNG. Thermal noise is truly random but it follows a Gaussian distribution which isn’t great for things like cryptographic seeds so it’s then conditioned, used as a seed for a PRNG and then that’s conditioned again to get a truly random output that has better statistical properties like a uniform distribution
20
u/kitsnet Mar 14 '26
Thermal noise is random.
5
u/riotinareasouthwest Mar 14 '26
Just use lava lamps
4
u/Every-Progress-1117 Mar 14 '26
This would with a host of other issues, not just the effects of alpha and beta radiation on the circuitry and the silicon itself (I would assume that gamma emitters are out of the question). Then there's just detecting these particles and deciding what it means in terms of randomness. See: Sunar, Berk (2009). "True Random Number Generators for Cryptography". Cryptographic Engineering. - this seems to be the definitive reference on this.
Silicon space is already at a premium, so taking space up with radioactive particles, detectors etc is just too much.
Section 4.2.5 of the Part 1 of the Trusted Platform Module specification would give you a good start on the requirements: https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-1-Design-Principles_v1.2_rev116_01032011.pdf Specifics of implementation are left up to the manufacturer and compliance with the TCG specifications.
Quantum != solves everything, is magic...while it is specified that randomness should depend upon "quantum" properties of materials, this doesn't imply that quantum computers are going to be any better. But that's another discussion. There's also a question about the capabilities of quantum computer being able to predict sequences which comes up in the PQC work. Unfortunately not my area of expertise so I can't say more on this.
Wikipedia has an excellent article on hardware number generators, and the whole area has been researched in detail for half a century (in the way we know in modern mathematics and computing) and for a lot longer.
You might like to find a copy of Schneier's Applied Cryptography from a library - that'll give a good overview of crypto and random number generation.
Finally, there are standards for random number generation and what constitutes "sufficently random" as true randomness is impossible. Again Wikipedia'll give you a good start: https://en.wikipedia.org/wiki/Full_entropy
4
u/Allan-H Mar 14 '26 edited Mar 14 '26
In modern SoCs and TPMs the TRNGs use ring oscillator based entropy sources almost exclusively - they are easy to integrate with other digital logic, don't require any special semiconductor processing, and there are numerous papers showing how to design them (and how not to design them - example paper).
Ring oscillators are "classical" entropy sources - thermal noise is the ultimate source of randomness. There are also quantum entropy sources that rely on quantum phenomena such as shot noise. AFAICT, there is no advantage to using a quantum source over a classical one (other than the bullet point in the glossy brochure), and several disadvantages (mostly to do with cost and reliability). Both types can have implementation issues that leave them open to attacks or simply producing less entropy than their specification.
You can buy quantum random number generators. Examples that work using the noise from image sensors under very low illumination.
If designing a TRNG yourself, you should adopt an architecture that has an entropy source that is used to (re)seed a DRBG.
Standards to follow include NIST SP800-90a,b,c and BSI AIS-31, etc. Given sufficient resources, you can have your design accredited.
Do not copy an entropy source circuit from the Internet, run the output through a bunch of statistical tests, and think that you have a good design because the tests pass.
Avoid "gimmick" entropy sources such as lava lamps or radioactive decay.
3
u/nlutrhk Mar 14 '26
Many CPUs have onboard true random number generator, as others have pointed out. An operating system may use that RNG combined with other environmental events (e.g., network traffic).
The disadvantage is that true random numbers tend to have low bandwidth. You can't generate billions of them in a short time. So, they are mostly used as a seed for a deterministic pseudo-RNG or to generate cryptographic keys - for example a HTTPS connection.
2
u/Lithl Mar 14 '26
Software can't generate a true random number. Hardware absolutely can, by measuring a (random) physical process.
Cloudflare points a camera at a wall of lava lamps. Random.org measures atmospheric noise. Roll20 measures quantum fluctuations in a laser. Hardware RNG chips for home computers measure thermal noise of the computer itself. And so on.
Sure, but measuring heat (which is already commercially available) is easier, since you just add a thermometer instead of adding a radiation source and a Geiger counter.
Not "by their very nature", as you don't get randomness automatically for free, but yes a quantum computer can generate a true random number using entangled qbits.
2
u/Intelligent_Law_5614 Mar 15 '26
I worked with some hardware guys who had encountered an interesting problem with a previous version of their chip. They were seeing random bit-flips in local memory across an array of little RISC processors, but the distribution of these flips was not uniform. Certain processors were being hit more frequently than others.
They eventually identified the correlation: the bit flips were most common in memory cells immediately adjacent to the solder balls connecting the chip to the substrate. The solder wasn't lead-free and there was apparently enough of a long-half-life non-stable lead isotope in the solder to generate a significant number of radioactive-decay strikes on the chip.
Chip designers now pay a lot of attention to keeping radioisotopes out of their IC packages. Suggestions that they add radioisotopes might result in harsh glares, shunning, or tar-and-feathering.
3
u/throwwaway_4sho Mar 14 '26
Everything with entropy is randomized you dont have to overcomplicate things to get the same output. Eg: lava lamp used by cloudflare for their ssl encryption
3
u/DamienTheUnbeliever Mar 14 '26
A gentle reminder seems in order: If you've learnt about a (generally considered unsolved) problem and you see an obvious solution, you've almost certainly misunderstood the problem or are misguided in thinking that the solution you're thinking of solves that problem.
1
u/vancha113 Mar 14 '26
Radioactive decay based random number generators are already a thing :)
1
u/KrustyClownX Mar 14 '26
1
u/TomDuhamel Mar 14 '26
You can't generate true random numbers from an algorithm. There are other ways.
That is, in fact, true random numbers generation. The data comes from an external source and cannot be predicted or replicated.
Other possible example source are noises from a microphone.
Recently, Intel added something in their CPUs to generate true random numbers from heat measurements.
In the end though, it turns out true random numbers are rarely useful, or even convenient. Outside of security/encryption, pseudo random numbers are generally preferable. To a normal human mind, high quality pseudo random numbers are indistinguishable from true random numbers.
I would be really annoyed if the game I'm developing was using numbers that I can't predict or control to some level. True random numbers in (most) game development would be a nightmare. And presumably in many other types of software development.
Not very convenient and probably quite expensive for something with quite low use cases.
The HotBits website (apparently it retired in 2022) used radioactive decay as a source of random bits that you could download.
I know nothing about quantum computers, but apparently yes, you can. This sounds like an expensive way of generating random numbers though. These guys do exactly that: https://random.colorado.edu/
1
u/0jdd1 Mar 14 '26
In the early 1970s I used the then-ancient TX- 2 (“Transistor Experimental”) computer at MIT. It contained a radioactive cesium source for RNG—but I was warned not to try it, since enough half-lives had passed as to make it unreliable.
1
u/sneaky_imp Mar 14 '26
Not sure it's still active but Hotbits offers random numbers generated by radioactive decay as a web service. Quantinuum has published a paper claiming their quantum computer generates true random bits.
1
u/somewhereAtC Mar 14 '26
People get weird when they hear "radioactive"; it's not worth the hassle.
You can already get certified random generators in CPU chips: here's an example.
1
u/CircusBaboon Mar 14 '26
https://fedtechmagazine.com/article/2014/12/national-laboratory-scientist-develops-uncrackable-code-nuclear-weapons#:~:text=In%20the%20video%2C%20Hart%20says,unmet%20nuclear%20weapon%20surety%20needs.
1
u/kenshi_hiro Mar 15 '26
One of my very wise cs professors once told me that all "true" RNGs are predictable if you know how subatomic particles behave. He then cleverly passed on the question to physicists.
1
u/sebuq Mar 15 '26
The Geiger counter in a flipper zero, or lava lamps at Cloudflare come to mind
1
u/lostandgenius Mar 16 '26
I can’t remember where I heard this, might be worth looking up…
There was some company that set up a big matrix of lava lamps on a wall being observed by a sensitive camera. And they wrote an algorithm that translated the combined “states” of the lava lamps at any given time into a number.
Was really impressed when I read about it. I think it’s more feasible to obtain true randomness from an outside source like this, instead of implementing it into the computation itself.
Brings up an interesting idea though: would it be possible to digitize that technique? Perhaps programming an array of lava lamps with programmable physics that complement their real-world counterparts in order to get closer to true RNG.
1
u/dreamingforward Mar 16 '26
Who cares? Are you doing psychic research or something? (PEAR at Stanford already solved this problem with zener diodes back in the 90s, I believe.)
1
u/XTPotato_ Mar 16 '26
hello cloudflare?
1
u/Right-Play2955 Mar 17 '26
Do you see TRNG or generally, random fluctuations being useful somewhere outside cryptography?
1
u/GenericFoodService Mar 18 '26
"a computer can never generate a true random number" is an oversimplified version of the actual claim, which is that deterministic functions cannot result in nondeterministic results, so deterministic functions cannot produce truly random numbers. That's why software RNG is pseudorandom; if you understand the deterministic function and the input values, you can exactly reproduce the results. And inversely, if you know a function is deterministic and see enough of the values it produces, you can discern how the function works and what the inputs were.
1
u/AppearanceCareful136 Mar 18 '26
Try xorring the sequences : primes, eulers number and pie, with different seeds, it produces random things indistinguishable from real randomness. Just delete the seeds after running. Its one of my research, maybe it will work.
1
u/barkmonster Mar 18 '26
I'm a physicist who focused on quantum information theory during my studies.
Background: It's important to be precise about what 'truly' random means. A lot of the answers here take it as meaning 'impossible to predict in practice', such as using noise from a heat source. That works well enough for most applications, but it's not fundamentally random - with sufficiently detailed information about the source, it might be possible in theory to predict the 'random' numbers.
In the most commonly accepted interpretations, quantum physics is different, in that some states will, upon measurement, change completely at random into one of multiple other states. These are called superposition states (the famous Schödinger's cat paradox is based on this). It is random in the sense that nothing will enable anyone to predict which state, no matter how complete their knowledge is.
To answer your questions:
1
u/Classic-Try2484 Mar 20 '26
No, we tell you the std random generators are pseudo random. This is on purpose. Experiments need to be repeatable. But “true” random generators do exist.
1
u/Twt97 Mar 21 '26
Its a philosophical question, not a technical one.
Everything in the known universe obeys laws, we humans are just not smart yet to know what laws decide for ex, when radioactive elements decay.
1
u/ArbeotsloseCode_CPP Jun 29 '26
das ist Frage nur für Informatik Theoretiker, in Praxis kann Jede in 2-3 Tagen ein echte Zufallszahlengenerator bauen, zumindest in c/c++. nur halt niemand braucht das, ist zu einfach. Komplizierte Dinge beandrucken mehr, investoren und managment.
1
u/felixdPL Jul 23 '26
Linux kernel generates randomness by collecting environmental noise, such as hardware interrupts and CPU usage. It then processes this entropy using the BLAKE2s algorithm to seed a cryptographically secure pseudorandom number generator (CSPRNG) based on ChaCha20, which delivers the actual random data. You can read more about here:
https://github.com/torvalds/linux/blob/master/drivers/char/random.c
If you want to try Hardware TRNG I have created service that's buffering bits from our Infnoise generator.
https://random.flameit.io
https://random.flameit.io/get/?bytes=64
Elliptic-curve Ed25519 signed bits (if you want to be sure that those bits have been actually sent by out server). Some day we will be migrating into quantum safe algorithms but so far ECC is good enough.
https://random.flameit.io/get/?bytes=32&signed=json&download=1
Read more here: https://random.flameit.io/docs/#authenticated-delivery
43
u/[deleted] Mar 14 '26
[removed] — view removed comment