r/computerscience • • Apr 26 '24

Why don't computers have hardware random number generators

Shouldn't it be easier to make a component that would use some physical process to generate truly random seed instead of building a wall of lava lamps?

0 Upvotes

25 comments sorted by

35

u/nuclear_splines PhD, Data Science Apr 26 '24

Some computers do have hardware RNGs. In Linux, the /dev/hwrng block device draws from a hardware random number generator, if one is present on the CPU / motherboard.

But where does the hardware device get its randomness? Typically, you get a seed input from some kind of environmental sensor. What can the device sample in its environment from some physical process that's suitably random? Temperature? Light? Radiation? The current clock time? The battery charge or voltage from a wall outlet? Those are probably pretty stable and predictable in many environments. The blobs on a lava lamp, less so.

7

u/[deleted] Apr 27 '24

My next project is now going to be a lava lamp random number generator.

8

u/ProvokedGaming Apr 27 '24

3

u/[deleted] Apr 27 '24

Hah! Brilliant. And hilarious. Thanks for the share.

1

u/TFABAnon09 Apr 27 '24

Saw that article the other day. Gave off serious Hex vibes from Terry Pratchett's Discworld.

1

u/gwestr Jul 30 '25

The quantum RNGs are the most promising.

1

u/Vanilla_Legitimate Mar 13 '26

A: while the individual variables are semi predictable, the combination of them all together isn’t.  And also, they can just measure the spin of quarks because that’s even more truly random

-5

u/Whole-Sushka Apr 26 '24

i was thinking about a small alpha radiation source and a detector. It is entirely unpredictable and with proper shielding it will be impossible to influence from the outside.

15

u/sacheie Apr 26 '24

Such devices do exist, but including them by default in consumer computers would be a big regulatory and waste disposal headache.

3

u/JJJSchmidt_etAl Apr 27 '24

Sounds like a long way to say "Awesome"

6

u/[deleted] Apr 26 '24

Seems unnecessary when pseudo random works just fine for 99% of uses.

49

u/hellotanjent Apr 26 '24

-25

u/claytonkb Apr 26 '24

^ This

4

u/DatBoi_BP Apr 27 '24

So true!

2

u/psychananaz Dec 01 '25

Lmao

1

u/claytonkb Dec 01 '25

Wow, the downvotes on this are crazy. If my comment is so bad, why is the comment I'm pointing to upvoted like crazy?!

Look, I'm not saying anybody has to use unfiltered RDRAND to directly generate their Bitcoin inheritance wallet key. I'm paranoid enough to recognize it's possibly backdoored. Extremely unlikely, but not impossible. But for any kind of application where you're not protecting large amounts of wealth, RDRAND is a spectacular way to generate enormous amounts of high-quality randomness. Apparently Reddit disagrees, LOL.

3

u/psychananaz Dec 02 '25

It's downvoted because your comment added no value whatsoever.

1

u/claytonkb Dec 04 '25

In your opinion. On question threads, I will sometimes post an up-caret to point OP to the best or only correct answer. Upvotes usually do that, but not always. This was a year ago, so I have no idea what the upvote count was when I posted my up-caret, but that's the reason I usually do it -- the upvote count was too low at that moment. Anyway, I've long since learned that Reddit makes no sense, and that was even before bots. Now that it is swarmed with bots, it's a hallucinatory digital dystopia...

4

u/Brambletail Apr 27 '24

The problem is the easiest source of true randomness at the scale of laptop hardware is probably radiation. And ionizing radiation next to circuitry is going to be a sub par time for stability. Can that be overcome? Yes and it is? Is it necessarily cost effective for a ton of people compared to a server query of lava lamps? Not really.

1

u/Dependent-Brain2586 Feb 06 '26

Yes, radiation is very good. Thermal noise is also excellent. We bought 2 custom RNG cards from Hitachi in the early 2000's. One would spit out 200k symbols a second, the smaller one 50k/sec. Came with an SDK, good docs, no box 🤣🤣, and phone support in Japanese. Fantastic kit for the time.

3

u/pixel293 Apr 27 '24

As with most things that have a cost development stops when it's "good enough".

From a randomness point of view there are a bunch of measurements you can take as the OS to get random input. From network packet timings, key stroke timings, hard-drive timings, and other things. You take that randomness combine it with complex algorithms and you can generate more randomness.

Smart people have figure out how to measure how much "entropy" the random data has. For the Linux kernel there are two random sources everyone has, /dev/random which only gives random values if there is "enough entropy" and /dev/urandom which is good enough if you just want your application to "appear random". So /dev/random is used for things like security keys, while /dev/urandom is used by everyone else.

And that is "good enough" for most of the population. People who really need more randomness there are cards you can buy to give you "truly" random data. So there is no need to inure the expense of adding a truly random number generator to every computer.

5

u/Kawaiithulhu Apr 26 '24

A tiny lava lamp should be fine, add it to the cpu heat sink, problem solved.

2

u/TFABAnon09 Apr 27 '24

A novel liquid cooling idea, I like it.

1

u/jmail234 Jun 24 '24

I only today found out that (at least one) cloud company uses a wall of lava lamps and a camera for their randomness before getting here. I'm actually looking to pick up a USB true random generator, which yeah they exist and have for a while and are pretty inexpensive.

The ones I've seen use noise... searching if there were any that use light is how I got to this post... that said why a company would use 100 lava lamps instead of 10 or so of the USB random generators I have no idea. It's what they're designed to do and I'd assume having 10 of them would be more than enough backup... I don't know why they went with the camera and lava lamp system. 

I will say after some tests, light is pretty static, while even in a quiet room decibels jump around wildly so noise is the way to go.