48#if LASS_COMPILER_TYPE == LASS_COMPILER_TYPE_MSVC
49# pragma warning(disable: 4996)
51# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
81void RandomParkMiller::seed(result_type seed)
83 buffer_ = seed ^ seedMask_;
93 buffer_ = multiplier_ * (buffer_ - k * schrageQuotient_) - k * schrageRest_;
105 index_(stateSize_ + 1)
127 for (
TValue i = 1; i < stateSize_; ++i)
129 state_[i] = (1812433253 * (state_[i - 1] ^ (state_[i - 1] >> 30)) + i);
141 if (index_ >= stateSize_)
151 y ^= (y << 7) & 0x9d2c5680;
152 y ^= (y << 15) & 0xefc60000;
163void RandomMT19937::reload()
168 if (index_ == stateSize_ + 1)
174 for (; k < stateSize_ - shiftSize_; ++k)
176 state_[k] = twist(state_[k], state_[k + 1], state_[k + shiftSize_]);
178 for (; k < stateSize_ - 1; ++k)
180 state_[k] = twist(state_[k], state_[k + 1], state_[k + shiftSize_ - stateSize_]);
182 state_[stateSize_ - 1] = twist(state_[stateSize_ - 1], state_[0], state_[shiftSize_ - 1]);
189 static const result_type magic01[2] = { 0x0, 0x9908b0df };
191 const result_type y = (a & 0x80000000) | (b & 0x7fffffff);
192 return c ^ (y >> 1) ^ magic01[y & 0x1];
199RandomXorShift128Plus::RandomXorShift128Plus()
203RandomXorShift128Plus::RandomXorShift128Plus(result_type seed)
211 const TValue y = state_[1];
214 state_[1] = x ^ y ^ (x >> 17) ^ (y >> 26);
215 return state_[1] + y;
218void RandomXorShift128Plus::seed(result_type seed)
228RandomRadicalInverse::RandomRadicalInverse(
size_t base) :
231 invBase_(1. / static_cast<
TValue>(base))
242 const size_t r = n % base_;
245 result +=
static_cast<TValue>(r) * f;
250void RandomRadicalInverse::seed(
size_t index)
num::Tuint32 TValue
type of return value.
void seed(result_type seed)
initializes with a seed.
result_type operator()()
draw a random number
num::Tuint32 result_type
type of return value.
RandomMT19937()
default constructor.
num::Tuint32 TValue
type of return value.
result_type operator()()
draw a random number
num::Tuint32 result_type
type of return value.
RandomParkMiller()
default constructor.
double TValue
type of return value.
int result_type
type of return value.
num::Tuint64 TValue
type of return value.
numeric types and traits.
Library for Assembled Shared Sources.