in reply to Re^3: How likely is rand() to repeat?
in thread How likely is rand() to repeat?
Let's say we were on a 2 bit processor and we had a 2-bit PRNG. There could only be 22 starting points (seeds).
But the (non-repeating) sequences it could produce are any permutation of the following 24 permutations of the 4 basic values it can produce:
{0, 1, 2, 3} | {0, 1, 3, 2} | {0, 2, 1, 3} | {0, 2, 3, 1} | {0, 3, 1, 2} | {0, 3, 2, 1} | {1, 0, 2, 3} | {1, 0, 3, 2} | {1, 2, 0, 3} | {1, 2, 3, 0} | {1, 3, 0, 2} | {1, 3, 2, 0} | {2, 0, 1, 3} | {2, 0, 3, 1} | {2, 1, 0, 3} | {2, 1, 3, 0} | {2, 3, 0, 1} | {2, 3, 1, 0} | {3, 0, 1, 2} | {3, 0, 2, 1} | {3, 1, 0, 2} | {3, 1, 2, 0} | {3, 2, 0, 1} | {3, 2, 1, 0}
Hence, the 32-bit, Mersenne Twister MT19937 can produce 219937 - 1 values (from any given starting point) before it repeats itself exactly.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: How likely is rand() to repeat?
by JavaFan (Canon) on Mar 09, 2012 at 03:21 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2012 at 05:48 UTC | |
by JavaFan (Canon) on Mar 09, 2012 at 10:37 UTC | |
by BrowserUk (Patriarch) on Mar 09, 2012 at 11:50 UTC | |
by JavaFan (Canon) on Mar 09, 2012 at 14:02 UTC | |
|