http://qs321.pair.com?node_id=272881


in reply to Can I seed srand() with results from rand()?

If rand() is a linear congruential generator (usually the case) with modulus $M, then this

srand( rand($M) )

is likely to be almost equivalent to calling rand() once or twice. Not quite, because there might be extra magic in srand(), and some rand()s only return 15 bits of randomness (even though they're seeded with 31). You might not care about having your entropy reduced to that, so go ahead with your plan. Otherwise, look into an alternate PRNG that gives you access to its internal state, like Math::Random.

What you want to avoid is using a seed with an obvious pattern in a loop. This is bad:

srand( $n += 42 )

And keep in mind that more things have obvious patterns than you might think.