r/computerscience • • Jan 27 '24

How tf do computers generate random numbers?

Hi guys, I’ve been using random number generators lately and I can’t seem to figure out how a computer can generate a random number. Don’t they just do what they’re told? Please explain like im stupid Edit: holy moly this is blowing up

501 Upvotes

178 comments sorted by

View all comments

Show parent comment

112

u/theusualguy512 Jan 27 '24

Apparently according to their website, they weren't the first ones who did it either (Silicon Graphics had seemingly patented it in 1996 but the patent expired).

They mix the lava lamp data with the ones generated from the Linux OS to ensure maximum entropy.

It's generally an interesting rabbit hole to fall into although I honestly do not understand the mathematics behind many of the algorithms for pseudorandom numbers and why they are proven to be mirroring random distributions.

Two popular algorithms for pseudorandom numbers according to Wikipedia seem to be the Mersenne Twister and PCG, Python uses PCG64 by default.

16

u/[deleted] Jan 28 '24

Well if Silicon Graphics did it that we can be sure NVidia ripped it off and did it.

0

u/[deleted] Jan 29 '24

I wonder if mixing the lava lamps with the Linux stuff actually makes it worse.. because it's possible that the exact state of the Linux box is influencing the lava lamps.

I'm mostly kidding, but chaos is strange like that.