in reply to Predictable Randomness

You need to take advantage of how perl's srand works. If it's passed the same number, then all subsequent rand calls will return the same sequence of random numbers. So what I'd do is:

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re: Re: Predictable Randomness
by trantor (Chaplain) on Aug 13, 2001 at 21:02 UTC

    Just as a side note, generating random numbers for network usage is much harder than it seems.

    In the above case security and true unpredictability are not fundamental, so it might be enough to feed srand with the current time. It's at least advisable to XOR it (the current time) with the process ID: busy Web server are likely to respond to more than one request per second, which is the resolution returned by time and similar.

    When security is a concern, this RFC can be very useful. It's an interesting reading anyway.

    -- TMTOWTDI

Re (tilly) 2: Predictable Randomness
by tilly (Archbishop) on Aug 13, 2001 at 21:09 UTC