DEV Community

Discussion on: Random numbers in CSS? Really? 🎲🤔

Collapse
 
togakangaroo profile image
George Mauer

Electricity either flows (1) or it doesn't (0)

If we're breaking things down then this isn't true either, right? Some electrons are always being passed around and electricity is already following. It is neither constant not discrete and certainly not digital. In fact nothing about zeros and ones has anything to do with electricity at all but with information theory which posits exalt that reliable, digital systems can be created from unreliable analog ones. Interestingly enough, if you could go the other direction, you probably could get true random numbers but at that point Claude Shannon decided he had done enough and wanted to do juggling for a while.

Anyways, that's been your pedantic aside 😁

Collapse
 
thormeier profile image
Pascal Thormeier

You're technically right, yes. Usually it's either a lot of electrons (as in 6.24 * 10^18) flowing, or next to none. That's usually enough of a difference to be more or less reliable in a sense. Of course, quantum weirdness plays in as well. A CSS-only-RNG needs a user to give an input to settle down on a single number, much like a particle in a superposition needs an observer. 😄