top | up | prev | next

MT Class

Definition at line 58 of Random.cpp

Constructors

MT()

Member Functions

uint32_t GenRand()
void Init(uint32_t seed)
void InitWithRandomSeed()
bool Initialized()

Member Variables

bool initialized
const uint32_t lowerMask static
const int32_t m static
const uint32_t matrixA static
int32_t mti
const int32_t n static
const uint32_t upperMask static

Constructor Details

MT Constructor

soulng::util::MT::MT()

Definition at line 122 of Random.cpp :
122 : initialized(false)mti(0)mt()mag()
123 {
124 }


Declaration at line 67 of Random.cpp


Member Function Details

GenRand Member Function

uint32_t soulng::util::MT::GenRand()

Definition at line 88 of Random.cpp


Init Member Function

void soulng::util::MT::Init(uint32_t seed)

Definition at line 77 of Random.cpp :
 78 {
 79     initialized = true;
 80     mt[0] = seed;
 81     for (mti = 1; mti < n; ++mti)
 82     {
 83         mt[mti] = 1812433253u * (mt[mti - 1] ^ (mt[mti - 1] >> 30u)) + static_cast<uint32_t>(mti);
 84     }
 85     mag[0] = 0u;
 86     mag[1] = matrixA;
 87 }


Called by: soulng::util::MT::InitWithRandomSeed


InitWithRandomSeed Member Function

void soulng::util::MT::InitWithRandomSeed()

Definition at line 72 of Random.cpp :
 73 {
 74     uint32_t seed = get_random_seed_from_system();
 75     Init(seed);
 76 }


Calls: soulng::util::MT::Init


Initialized Member Function

bool soulng::util::MT::Initialized()

Definition at line 68 of Random.cpp :
 69 {
 70     return initialized;
 71 }



top | up | prev | next