Hello all,
This question may not be language specific.
- Is it possible to create a true random number ?
- If not why random number generation has to go through some algorithm, why garbage values cannot act as random numbers.
Hello all,
This question may not be language specific.
Garbage values are unpredicted, and you can't make any assumptions on them.
If you want a true random number, your algorithm would have to involve some "real-world" variables (e.g, the CPU temperature, fan speed, environmental noise..). Otherwise, your "random" values, would be very predictable.
There is no known "true" random number generator (as of now), but we do have pseudo random number generators, which generate number which can act as random numbers for "practical" purposes.
By "garbage values" I presume you mean uninitialized memory. You're not going to get good distribution, and more importantly you're going to get a lot of sequences of repeated values. Getting thousands of the same number in a row would be pretty useless for most applications that require random numbers.
For a number to be a "true random number", it would have to be non-deterministic. And since pretty much everything is (probably) deterministic, there really is no such thing as a random number. Mixing of atmospheric noise is probably the closest you can get at this point.
Computers are deterministic and can only generate pseudorandom numbers, unless they rely on some external stochastic process.
A pseudorandom number generator forms a sequence, which sooner or later is going to repeat.
Of course, very long sequences may be practically indistinguishable from 'truly random' numbers.
A 'garbage value' might be used to seed a random number generator, but then the question would be 'what range of values are being used for a seed?
It may introduce predictability, since we know some pseudorandom number generators produce the same sequence when seeded identically.