On 9/13/07, Austin Nichols <[EMAIL PROTECTED]> wrote:
> As long as quackle is drawing a new seed at the start of every
> iteration based on a nearly random cpu state, depending on the time in
> milliseconds taken to compute various things, with unknown other
> processes running, the period for simulation iterations should be near
> infinity and you would never have a situation where running 10^z
> iterations is the same as running a sim with 10^(z-1) iterations ten
> times in a row and stacking them, right?

Actually, no.  The period of a PRNG depends on the specific PRNG and
generally you can't trust the plain system rand() implementation for a specific
number, although it's a safe bet that indeed it is larger than the number of
sims you can execute.

But the best way to do this is to set the seed just *once* and then start
using the stream of randoms, which guarantees a looping period equal
to the periodicity of the PRNG.  When you start resetting the seed, you
shorten the time to a repeat because you might be jumping to a place
near to where it loops, or back to a place where you started a run before.
(Of course, again, the probability of hitting the *exact* same state is tiny,
as in practice merely a close overlap is not usually a problem except in
cryptography)

The way to guarantee non-repeatability for your specific app is to use your
own PRNG rather than the system one, and use one which has been well
studied and its parameters - including periodicity - well known.

Graham

Reply via email to