18 #ifndef itkMersenneTwisterRandomVariateGenerator_h
19 #define itkMersenneTwisterRandomVariateGenerator_h
125 struct MersenneTwisterGlobals;
176 GetVariateWithClosedRange();
180 GetVariateWithClosedRange(
const double n);
184 GetVariateWithOpenUpperRange();
188 GetVariateWithOpenUpperRange(
const double n);
192 GetVariateWithOpenRange();
196 GetVariateWithOpenRange(
const double n);
214 GetNormalVariate(
const double mean = 0.0,
const double variance = 1.0);
219 GetUniformVariate(
const double a,
const double b);
227 GetVariate()
override;
268 PrintSelf(std::ostream & os,
Indent indent)
const override;
271 static constexpr
unsigned int M = 397;
280 return u & 0x80000000;
285 return u & 0x00000001;
290 return u & 0x7fffffff;
295 return hiBit(u) | loBits(v);
301 return m ^ (mixBits(s0, s1) >> 1) ^ (-static_cast<int32_t>(loBit(s1)) & 0x9908b0df);
305 hash(time_t t, clock_t c);
317 std::atomic<IntegerType> m_Seed{};
328 std::mutex m_InstanceLock{};
351 *s++ = seed & 0xffffffffUL;
354 *s++ = (1812433253UL * (*r ^ (*r >> 30)) + i) & 0xffffffffUL;
375 *p =
twist(p[
M], p[0], p[1]);
377 for (i =
M; --i; ++p)
379 *p =
twist(p[index], p[0], p[1]);
427 s1 ^= (s1 << 7) & 0x9d2c5680;
428 s1 ^= (s1 << 15) & 0xefc60000;
429 return (s1 ^ (s1 >> 18));
502 return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
517 return mean + r * std::cos(phi);
527 return ((1.0 - u) * a + u * b);