30 for(
int i=1; i<624; i++) {
31 fMt[i] = (1812433253 * (
fMt[i-1] ^ (
fMt[i-1] >> 30)) + i );
44 const uint32_t kTemperingMaskB = 0x9d2c5680;
45 const uint32_t kTemperingMaskC = 0xefc60000;
46 const uint32_t kUpperMask = 0x80000000;
47 const uint32_t kLowerMask = 0x7fffffff;
48 const uint32_t kMatrixA = 0x9908b0df;
53 for (i=0; i < kN-kM; i++) {
54 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
55 fMt[i] =
fMt[i+kM] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
58 for ( ; i < kN-1 ; i++) {
59 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
60 fMt[i] =
fMt[i+kM-kN] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
63 y = (
fMt[kN-1] & kUpperMask) | (
fMt[0] & kLowerMask);
64 fMt[kN-1] =
fMt[kM-1] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
70 y ^= ((y << 7 ) & kTemperingMaskB );
71 y ^= ((y << 15) & kTemperingMaskC );
75 if (y)
return ( (
double) y * 2.3283064365386963e-10);
double Rndm_impl()
generate a random double number
void SetSeed(unsigned int seed)
set the seed x
static const double x1[5]