18#ifndef itkMersenneTwisterRandomVariateGenerator_h
19#define itkMersenneTwisterRandomVariateGenerator_h
122struct MersenneTwisterGlobals;
273 static constexpr unsigned int M = 397;
282 return u & 0x80000000;
287 return u & 0x00000001;
292 return u & 0x7fffffff;
303 return m ^ (
mixBits(s0, s1) >> 1) ^ (-
static_cast<int32_t
>(
loBit(s1)) & 0x9908b0df);
352 *s++ = seed & 0xffffffffUL;
355 *s++ = (1812433253UL * (*r ^ (*r >> 30)) + i) & 0xffffffffUL;
375 *p =
twist(p[
M], p[0], p[1]);
377 for (
int 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));
504 return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
519 return mean + r * std::cos(phi);
529 return ((1.0 - u) * a + u * b);
Control indentation during Print() invocation.
Implements transparent reference counting.
IntegerType state[StateVectorLength]
std::atomic< IntegerType > m_Seed
IntegerType loBits(const IntegerType &u) const
double GetUniformVariate(const double a, const double b)
IntegerType GetIntegerVariate()
IntegerType mixBits(const IntegerType &u, const IntegerType &v) const
static Pointer New()
Method for creation through the object factory.
static Pointer GetInstance()
static constexpr unsigned int M
void PrintSelf(std::ostream &os, Indent indent) const override
IntegerType twist(const IntegerType &m, const IntegerType &s0, const IntegerType &s1) const
double GetVariateWithOpenRange()
IntegerType loBit(const IntegerType &u) const
void Initialize(const IntegerType seed)
static IntegerType GetNextSeed()
SmartPointer< const Self > ConstPointer
void SetSeed(const IntegerType oneSeed)
static IntegerType hash(time_t t, clock_t c)
IntegerType GetSeed() const
~MersenneTwisterRandomVariateGenerator() override
static void ResetNextSeed()
itkGetGlobalDeclarationMacro(MersenneTwisterGlobals, PimplGlobals)
MersenneTwisterRandomVariateGenerator Self
SmartPointer< Self > Pointer
double GetVariateWithClosedRange()
double GetVariateWithOpenUpperRange()
static Pointer CreateInstance()
static MersenneTwisterGlobals * m_PimplGlobals
RandomVariateGeneratorBase Superclass
IntegerType hiBit(const IntegerType &u) const
double GetVariate() override
double GetNormalVariate(const double mean=0.0, const double variance=1.0)
MersenneTwisterRandomVariateGenerator()
static constexpr IntegerType StateVectorLength
std::mutex m_InstanceMutex
RandomVariateGeneratorBase()
static constexpr double pi
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....