49 Mersenne(
unsigned long seed) {
50 mt[0]= seed & 0xffffffffUL;
51 for (mti=1; mti<N; mti++) {
53 (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
58 mt[mti] &= 0xffffffffUL;
64 unsigned long Mersenne::
67 static unsigned long mag01[2]={0x0UL, MATRIX_A};
73 for (kk=0;kk<N-M;kk++) {
74 y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
75 mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
78 y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
79 mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
81 y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
82 mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
91 y ^= (y << 7) & 0x9d2c5680UL;
92 y ^= (y << 15) & 0xefc60000UL;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.