> The default IRNG is Matsumoto and Nishimura's
> "Mersenne Twister" MT19937,
> which has a period of 2^19937-1 (i.e. it will never repeat).
Are you sure that you've got that right?
It seems to imply at least 19937 bits of state information.
> This generator has passed lots of stringent tests,
> including the Diehard suite.
But isn't it expensive?
How many rand(), random() or drand48() calls can execute
in the time it takes for one MT19937 call?
> Uniform<T, IRNG, stateTag>
> T: type of random number to generate (float, double, or long double
> for continuous distributions).
> Note that double + long double are slower to generate, because filling
> the entire mantissa with random bits requires several random integers.
A sequence of floating-point random numbers
initialized with the same seed should be the same
regardless of type. Suppose {f_k}, {d_k} and {l_k}
are random number sequences of type float, double
and long double respectively. Then
f_k = d_k and d_k = l_k
to within one unit last place of the least precise type.
This means that if you call the IRNG twice for each
double or long double precision random number,
you must also call it twice for each float precision
random number.
> RNGs have these methods:
>
> T random(); returns a random number
> void seed(unsigned int) seeds the IRNG
It is customary to overload
T Uniform<T, IRNG, stateTag>::operator ()(void) {
return random(): }
How do you know that type unsigned int is 32 bits?
I suggest that you look at the proposed ANSI C standard C9X
and choose something like uint32_t.
Good Luck, Bob Tisdale <edwin@netwood.net>