18 #ifndef itkMersenneTwisterRandomVariateGenerator_h
19 #define itkMersenneTwisterRandomVariateGenerator_h
125 struct MersenneTwisterGlobals;
181 GetVariateWithClosedRange();
185 GetVariateWithClosedRange(
const double n);
189 GetVariateWithOpenUpperRange();
193 GetVariateWithOpenUpperRange(
const double n);
197 GetVariateWithOpenRange();
201 GetVariateWithOpenRange(
const double n);
219 GetNormalVariate(
const double mean = 0.0,
const double variance = 1.0);
224 GetUniformVariate(
const double a,
const double b);
232 GetVariate()
override;
273 PrintSelf(std::ostream & os,
Indent indent)
const override;
276 static constexpr
unsigned int M = 397;
285 return u & 0x80000000;
290 return u & 0x00000001;
295 return u & 0x7fffffff;
300 return hiBit(u) | loBits(v);
306 return m ^ (mixBits(s0, s1) >> 1) ^ (-static_cast<int32_t>(loBit(s1)) & 0x9908b0df);
310 hash(time_t t, clock_t c);
322 std::atomic<IntegerType> m_Seed{};
333 std::mutex m_InstanceMutex{};
356 *s++ = seed & 0xffffffffUL;
359 *s++ = (1812433253UL * (*r ^ (*r >> 30)) + i) & 0xffffffffUL;
380 *p =
twist(p[
M], p[0], p[1]);
382 for (i =
M; --i; ++p)
384 *p =
twist(p[index], p[0], p[1]);
432 s1 ^= (s1 << 7) & 0x9d2c5680;
433 s1 ^= (s1 << 15) & 0xefc60000;
434 return (s1 ^ (s1 >> 18));
507 return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
522 return mean + r * std::cos(phi);
532 return ((1.0 - u) * a + u * b);