A pseudo random number generator is not actualy producing random numbers, just a series of numbers you can not predict, or you dont know. For you it looks random, but it would produce the same thing in the same situation, aka its deterministic.
And actual random number generator takes in some kind of external “randomness” like cosmic rays, radiation background noise.
Computers cannot generate a random number without some kind of randomized input. Computers don’t do random, they follow absolute logic. You can make a really complicated formula to, say, take the last digit of the millisecond timer of the system clock and multiply it by the day of the month and then divide it by the system volume setting and take the last digit of that and do more and more things to it, which really does *look* random. However, if you take the same *seed* – the same starting numbers – and feed it into the formula, you get the same number back out. That means that, with enough information, you can deduce the formula and figure out what the number will be. It might not be practical to do so, but it can be done. This is a *pseudo-random* number, because it *looks* random, it might *practically* be random, but it is not random.
A mechanical random number generator uses some kind of formula, just like pseudo-random generators, but the seed is taken from some source outside of the control of the computer. For the most advanced sorts, they might use a radioactive element and count how many milliseconds it’s been since the last atom decayed. Radioactive decay is a quantum process that *cannot possibly* be predicted, only averaged. Famously, the company Silicon Graphics used [a wall of lava lamps](https://en.wikipedia.org/wiki/Lavarand) as their seed, by having cameras take images of the lava lamps and using the values of brightness and color in each pixel. Some simpler generators use radio noise captured with a small antenna on some empty radio frequency.
Since the seed isn’t connected to the computer or generated with any kind of formula, and since the source of the feed is very unpredictable or, in the case of radioactive decay, fundamentally unpredictable, the formula can spit out a truly random number. Yes, you might know the formula that creates the random number, but since you can’t know the seed, you can’t predict the random number you’ll get.
I’m guessing you mean “hardware random number generator” not “mechanical random number generator”?
Lets start with pseudo-random number generators. These use some complex maths to create numbers that look random, but are entirely predictable. You put a number in, and they spit their random-looking number out.
For example, lets say the pseudo-random number function is called rnd(). You could make a sequence of 5 random numbers like this:
rnd(1) = 53656
rnd(2) = 48042
rnd(3) = 87968
rnd(4) = 1228
rnd(5) = 74576
To generate more random numbers you just keep increasing the number you give it by 1. However if you went back and did rnd(3) again you would always get 87968. In theory you might even be able to work backwards, knowing that say 1228 came from rnd(4) which would let you predict the next numbers. Not great for numbers that are supposed to be random!
Of course usually the numbers you’d feed it would be much higher than starting from 1, but the principal is the same. The start number you use is called the “seed”, often it might be say the exact date and time to the nearest millisecond that the computer boots plus or minus some other number just to mix it up a bit. That way you will get a different sequence of random numbers each time.
Now hardware random number generators use actual physical processes that are properly random. A common one is to count a radioactive element decaying because that is truly random. Or point a webcam at a lava lamp and convert the image into numbers, letting thermodynamics be the randomness. You could even flip physical dice and use a webcam to count the faces.
This is much slower than just using a random function, but unlike a random function the numbers you get are not predictable.
A psuedo-random number generator takes a “seed”, which is often the current time in milliseconds, and inputs it to a function that spits out another number, uniformly distributed across the possible outcomes. When another “random” number is needed, the first number spit out is fed back into the function to produce another number. The function is such that it is very difficult to predict what the next number will be based off of what the previously-produced numbers are, if you don’t have the starting seed, but if you and someone else use identical seeds you should get the same series of numbers.
A mechanical number generator is one that uses an external, unpredictable process to generate each number. A possible example of this is pointing a camera at a wall full of lava lamps, and then running a function over the resulting image data of a specific frame when a random number is needed. As lava lamps move in unpredictable ways, and very small changes to the visual state result in large changes to the result of a hashing function, this produces “true” random number generation. There are many physical processes that can be used this way – one could have a bunch of dice in a chamber that is regularly jostled, for instance, or you could measure radioactive decay patterns that happen at unpredictable intervals and trajectories.
Latest Answers