D
Dik T. Winter
Indeed, it does *not* mean that there are 2**19937-1 states, there may
be more. But it *does* mean that after calling it 2**19937-1 times
you are back at the original state. It is possible that the collection
of different states is a multiple of 2**19937-1, containing different
loops, each 2**19937-1 long.
Consider the following (extremely simple) random number generator:
s = (2 * s) % 17;
It has 16 states, but a period of 8. One cycle is:
1 -> 2 -> 4 -> 8 -> 16 -> 15 -> 13 -> 9 -> 1
the other is:
3 -> 6 -> 12 -> 7 -> 14 -> 11 -> 5 -> 10 -> 3
I do not know whether that is possible with a period of 2**19937-1, but
I can not exclude it, and I think it is extremely likely that it is
possible.
....
> If we put these together, we would see that srand(1) and srand(2)
> would have the same cycles -only- if it happened the the linear
> congruential generator applied to 0x1330E16 happened to result
> in 0x2330E16 at some point.
Indeed, but a question is also, what is the period of the generator?
> Further analysis would be needed to
> see whether that ever happened -- the default multiplier and
> constant for drand48() and kin are both even, so it is not
> the usual case that "every possible n-bit value will be generated,
> eventually".
Indeed, the least significant bit will always be 0. What I am wondering
however, what does
"the low-order 16 bits of Xi are set to the arbitrary value 330E16."
mean? By any reasonable interpretation of "330E16" I come to a value
where the low order 16 bits are 0.