59 #define MATRIX_A 0xB5026F5AA96619E9ULL
60 #define UM 0xFFFFFFFF80000000ULL
61 #define LM 0x7FFFFFFFULL
75 for (mti=1; mti<NN; mti++)
76 mt[mti] = (6364136223846793005ULL * (mt[mti-1] ^ (mt[mti-1] >> 62)) + mti);
78 srand((
unsigned int) seed);
89 static uint64_t mag01[2]={0ULL, MATRIX_A};
97 for (
i=0;
i<NN-MM;
i++) {
98 x = (mt[
i]&UM)|(mt[
i+1]&LM);
99 mt[
i] = mt[
i+MM] ^ (
x>>1) ^ mag01[(
int)(
x&1ULL)];
101 for (;
i<NN-1;
i++) {
102 x = (mt[
i]&UM)|(mt[
i+1]&LM);
103 mt[
i] = mt[
i+(MM-NN)] ^ (
x>>1) ^ mag01[(
int)(
x&1ULL)];
105 x = (mt[NN-1]&UM)|(mt[0]&LM);
106 mt[NN-1] = mt[MM-1] ^ (
x>>1) ^ mag01[(
int)(
x&1ULL)];
113 x ^= (
x >> 29) & 0x5555555555555555ULL;
114 x ^= (
x << 17) & 0x71D67FFFEDA60000ULL;
115 x ^= (
x << 37) & 0xFFF7EEE000000000ULL;
118 return x & 0x7FFFFFFFFFFFFFFF;