The best PRNG I know of that is not restricted in export due to crypto
applications is the Mersenne Twister and here is a fast version with
period up to 2^216091:
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
but I guess the issue is how often an 8-bit PRNG that produces 256
distinct *initial* letter orderings can produce e.g. identical first
rack draws.  Unless I am misunderstanding the code Jason quotes, it
shuffles on every tile draw, so even a period 2^8 PRNG would produce
O(2^(8)(14)) initial rack draws, no?  A 32-bit PRNG produces well over
a google initial draws and a trillion distinct 5-tile draws, so unless
people are simming over a trillion iterations (at which point the
simulations start repeating and are of no further value) there is no
cost to the low period.
Or am I misunderstanding the concern about rand()?

On 9/12/07, sapphirebrand <[EMAIL PROTECTED]> wrote:
> >     return rand();
>
> Jason, I hate to rain on your parade, but the C standard library
> function rand() is not really as good as you need it to be. It uses
> a multiplicative congruential generator, which means that the results
> are cyclic modulo N for any value of N that is relatively prime to
> the multiplier.
>
> Now, in your usage you will draw from a pool of size 100, then 99,
> and so on, so there is no fixed N that allows you to easily see the
> cyclic behavior. The non-randomness is disguised a bit. But you
> can find the issues. For instance, the value of rand() alternates
> between odd and even, so on the first 7 draws of the game you sample
> from bag size 100, 98, 96, and 94. All of those draws will come
> from slots having the same parity.
>
> I recommend the KISS random generator, which uses only 128 bits of
> state, provides a 32-bit result and passes all tests of randomness.
> You can find a reference here: http://www.math.niu.edu/~rusin/known-
> math/99/RNG
>
> Brian

Reply via email to