# How to generate "true" random numbers?

The random number block generates pseudo random numbers. How do you generate "true" random numbers? (I want to make a card game in Snap!)

is the Snap! RNG block not enough? And what do you even mean by true random numbers?

Its a PRNG which is not truly random.

But random enough for a card game.

Look up TRNG.

Snap!'s RNG uses the JS Math.random() function.
If you really want true RNG, you'll have to do it in JS (because of the outside sensors). So really this should be a StackOverflow topic.

Eh... I guess I'll just use Snap!'s PRNG.

We just went through this in another thread.

You can't make truly random numbers in software. It requires hardware support, because software is algorithmic, which means it does the same thing every time you run the same program with the same inputs in the same environment.

Back when people had spinning magnetic disks, one way they used to generate hardware random numbers was to see what sector of the disk is under the head right now. But many computers now have solid state disks, so that's no longer a good technique.

The textbook solution is to measure the voltage drop across a silicon diode. That voltage will be about 0.7 volts, but the exact value depends on quantum effects inside the diode. (Search for "voltage drop across diode" if you want the gory details.) So if you build an extremely precise voltmeter, and subtract 0.7 from the value it tells you, the result is a truly random number.

Disclaimer: I am not a physicist.