3
$\begingroup$

Would reseeding a PRNG with the PRN from the previous generation have any effects whatsoever on the quality of the generated numbers; if so, does this depend on the PRNG used, or are the effects generally applicable to any algorithm?

Perhaps I'll enhance the question with some pseudo-code:

firstSeed := get_seed_from_entropy_pool()
seed(firstSeed)
firstPrn := rand()
seed(firstPrn)
nextPrn := rand()

Is nextPrn already of inferior quality? Would quality decrease if repeated?

$\endgroup$
  • 1
    $\begingroup$ I suppose this depends on both the seed and the rand part of the algorithm. $\endgroup$ – Paŭlo Ebermann Mar 9 '14 at 13:51
  • $\begingroup$ It is only secure if the RNG is secure, the initial seed has enough entropy, and the number of bytes sampled for the seed is large enough. If rand() returns a 32-bit or 64-bit number, then this definitely isn't secure. The seed should be 256 bits. $\endgroup$ – Future Security Nov 4 '19 at 19:39
4
$\begingroup$

In most PRNGs, this leads to a total disaster, in particular when the generator's state is bigger than the result returned as pseudo-random (call to rand()).

If you take Mersenne Twister with its big period guaranteed and apply the construction you expose, as it returns 32-bit integers, eventually you will get a repeated value that was used to seed previously, so it turns into a loop. You'll get an about $2^{16}$ repeating sequence of pseudo randoms, according to the birthday probability, and not the guaranteed generator's period length. This same issue applies to all other generators if it's seeding is deterministic and guarantees that a given seed always generates the same sequence of pseudo randoms.

On the other hand, if you do some steps of autoseeding first and then you use the PRNG without seeding it anymore then it shouldn't affect its properties.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for your insights. I did not have a particular reason to ask this question and was purely motivated by curiosity. $\endgroup$ – Christian Kiewiet Mar 10 '14 at 20:15
  • $\begingroup$ @ChristianKiewiet Wellcomed $\endgroup$ – daniel Mar 11 '14 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.