
Mersenne Twister pseudorandom number generator of 32 and 64-bit.

This implementation has a template C++ class for 32 and 64-bit,
taking advantage of the underlying structure shared by both.

Because 32-bit version requires an array of 624 unsigned long and
64-bit counterpart needs 312, a constant was created in the header:
MaxState = 624 * sizeof(unsigned long) / sizeof(Integer)
where Integer can be unsigned long or unsigned long long.

A simple optimization was included. Instead of accessing the array
mag01[2]={0, MATRIX_A}
in the original code, the following lines were included:
(c & 1) * 0xffffffffUL
for 32-bit and
(c & 1) * 0xffffffffffffffffULL
for 64-bit. This fact is translated into assembly code as an AND
followed by a NEG operation.

This implementation has a speed-up of about 38% against the authors'
implementation on 64-bit version, about 70% on 32-bit and about
500% against rand(), generated by Microsoft Visual Studio 2005 Beta 2
targeted to x64 architecture, tested on a AMD Athlon 64 3000+ with
Microsoft Windows XP Professional x64 Edition.

Assembly code generated by the compiler is also included.

Diego Park
diegopark@gmail.com
