Reputation: 3867
Let's say we have a pseudo random number generator that accepts a 32 bit integer as seed (for example the rand()
function from the C standard library), which derives random numbers from the original seed. If that seed were to come from, let's say, radioactive decay, is it correct to assume that the random number we get from calling rand()
is as "good" random number as taking generating one from radioactive decay?
Upvotes: 2
Views: 1585
Reputation: 7852
Pseudorandom numbers(PRN) may be a sequence of near random numbers. However, the True random numbers (TRN) are the ones that generate random numbers by taking inputs from entropy sources which can be any kind of physical environment right from vibration to harddisk activity. The rand() of C library belongs to the category of PRN. For high randomness, it is better to go with libraries that use /dev/random or /dev/urandom.
Refer to manpage of urandom as well for more details on random, urandom - kernel random number source devices at https://linux.die.net/man/4/urandom. " The random number generator gathers environmental noise from device drivers and other sources into an entropy pool. The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool random numbers are created. "
Upvotes: 0
Reputation: 8538
No, definitely not. The C/C++ standard library's builtin rand()
function is usually implemented as a linear congruential generator (LCG). It is among the earliest known family of pseudorandom number generators (PRNGs) and they generally have notoriously bad statistical properties. Furthermore since PRNGs actually produce a mathematical sequence predetermined by an initial seed, they are predictable. Even cryptographically secure pseudorandom number generators (like the Blum Blum Shub) are predictable, even if it's computationally difficult and very time consuming to predict the sequence.
In contrast, random number generators based on radioactive decay are true random number generators. The generated sequence of numbers is perfectly uniformly distributed and unpredictable, without any measurable correlation between the samples.
Back to pseudorandom numbers, the statistical quality of the source of the initial seed doesn't improve the statistical quality of the generated pseudorandom sequence - it only depends on the generator itself. If you use a true random number to seed a PRNG, then the first number of the sequence will be unpredictable, but then the quality of the sequence will be the same as it would be without the true random seed.
If you want high quality of randomness, you have to use a high quality random number generator. There are pseudorandom number generators with excellent statistical properties (definitely not the famous Mersenne Twister), passing all current statistical tests of randomness - while the generated pseudorandom sequence is still predictable, statistically it's hard to distinguish from a truly random sequence.
A good reliable resource on modern random number generators is Sebastiano Vigna's website.
Upvotes: 2
Reputation: 45464
NO. The properties of the random number sequence depends entirely on the random number generator (RNG). Thus, any correlation between subsequent random numbers are down to the RNG and not to the seed.
However, having said that, the seed is important to avoid similarities between the sequences generated at different runs of your code. So, you should always attempt to seed your RNG with genuinely random seeds.
Upvotes: 1
Reputation: 11909
The quality of your random numbers comes from the quality of your random number generator. There are many and varied methods of generating pseudo random numbers, the one you choose should be suitable for your application, but to be honest, if you have access to radio active decay monitoring equipment, then you are probably able to access real random numbers (from some other totally random real world event), rather than seeding a pseudo one.
Upvotes: 1