Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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?

share|improve this question
1  
I suppose this depends on both the seed and the rand part of the algorithm. –  Paŭlo Ebermann Mar 9 at 13:51

1 Answer 1

up vote 3 down vote accepted

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

If you take Mersenne Twister with it's 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 it's properties.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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