49 #define MATRIX_A 0x9908b0dfUL
50 #define UPPER_MASK 0x80000000UL
51 #define LOWER_MASK 0x7fffffffUL
57 static unsigned long mt[
N];
63 mt[0]= s & 0xffffffffUL;
71 mt[
mti] &= 0xffffffffUL;
85 k = (
N>key_length ?
N : key_length);
87 mt[i] = (
mt[i] ^ ((
mt[i-1] ^ (
mt[i-1] >> 30)) * 1664525UL))
89 mt[i] &= 0xffffffffUL;
91 if (i>=
N) {
mt[0] =
mt[
N-1]; i=1; }
92 if (j>=key_length) j=0;
95 mt[i] = (
mt[i] ^ ((
mt[i-1] ^ (
mt[i-1] >> 30)) * 1566083941UL))
97 mt[i] &= 0xffffffffUL;
99 if (i>=
N) {
mt[0] =
mt[
N-1]; i=1; }
102 mt[0] = 0x80000000UL;
109 static unsigned long mag01[2]={0x0UL,
MATRIX_A};
118 for (kk=0;kk<
N-
M;kk++) {
120 mt[kk] =
mt[kk+
M] ^ (y >> 1) ^ mag01[y & 0x1UL];
124 mt[kk] =
mt[kk+(
M-
N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
127 mt[
N-1] =
mt[
M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
136 y ^= (y << 7) & 0x9d2c5680UL;
137 y ^= (y << 15) & 0xefc60000UL;
174 return(a*67108864.0+b)*(1.0/9007199254740992.0);