12 #ifndef SSTMAC_COMMON_RNG_H_INCLUDED 13 #define SSTMAC_COMMON_RNG_H_INCLUDED 37 return value() % range;
41 vec_reseed(
const std::vector<rngint_t> &seeds) = 0;
48 realvalue(
bool include_zero =
true,
bool include_one =
true) {
49 rngint_t v = this->
value();
52 double scaling = std::numeric_limits<rngint_t>::max();
53 if (
sizeof(rngint_t) > 6) {
54 int shiftbits = 8 * int(
sizeof(rngint_t)) - 53;
56 scaling = 9007199254740992.0;
60 scaling = scaling / 2.0 + 1.0;
75 reseed(rngint_t, rngint_t);
78 reseed(rngint_t, rngint_t, rngint_t);
81 reseed(rngint_t, rngint_t, rngint_t, rngint_t);
103 return ((z = 36969 * (z & 65535) + (z >> 16)) << 16);
108 return ((w = 18000 * (w & 65535) + (w >> 16)) & 65535);
124 construct(
const std::vector<rngint_t> &);
127 construct(rngint_t zarg);
130 construct(rngint_t zarg, rngint_t warg);
136 return (znew() + wnew());
140 vec_reseed(
const std::vector<rngint_t> &seeds);
178 construct(
const std::vector<rngint_t>&);
181 construct(rngint_t jsrarg);
188 vec_reseed(
const std::vector<rngint_t> &seeds);
205 rngint_t seed = time(NULL);
233 double maxZ = 2.0, rngint_t seed = 0);
269 construct(
const std::vector<rngint_t>&);
272 construct(rngint_t jcongarg);
278 return (jcong = 69069 * jcong + 1234567);
282 vec_reseed(
const std::vector<rngint_t> &seeds);
290 CONG(
const std::vector<rngint_t>&);
292 CONG(rngint_t jcongarg);
315 return "SimpleCombo";
322 construct(
const std::vector<rngint_t> &);
325 construct(rngint_t zarg);
328 construct(rngint_t zarg, rngint_t warg);
331 construct(rngint_t zarg, rngint_t warg, rngint_t jsrarg);
334 construct(rngint_t zarg, rngint_t warg, rngint_t jsrarg, rngint_t jcongarg);
342 return (mwc_->MWC::value() ^ cong_->CONG::value()) + shr3_->SHR3::value();
346 vec_reseed(
const std::vector<rngint_t> &seeds);
362 vec_reseed(
const std::vector<rngint_t> &seeds);
415 construct(
const std::vector<rngint_t> &seeds);
419 unsigned char i1, i2, i3, i4;
424 return (t[i1] = t[i1] + t[i2] + t[i3] + t[i4]);
430 vec_reseed(
const std::vector<rngint_t> &seeds);
469 construct(
const std::vector<rngint_t>&);
477 vec_reseed(
const std::vector<rngint_t> &seeds);
506 construct(
const std::vector<rngint_t>&);
510 rngint_t kresult = simplecombo_->SimpleCombo::value();
511 rngint_t sresult = swb_->SWB::value();
512 return kresult + sresult;
518 vec_reseed(
const std::vector<rngint_t> &seeds);
static const rngint_t default_z
static SHR3 * construct()
A base class for random number generators using a table of 256 32-bit integers.
virtual std::string to_string() const
virtual std::string to_string() const
virtual std::string to_string() const
The multiple-with-carry random number generator by George Marsaglia (1999; internet posting)...
virtual std::string to_string() const
SimpleCombo * simplecombo_
The congruential random number generator by George Marsaglia (1999; internet posting).
The 3-shift-register random number generator by George Marsaglia (1999; internet posting).
virtual std::string to_string() const
ExponentialDistribution(double lambda)
virtual std::string to_string() const
A lagged Fibonacci random number generator by George Marsaglia (1999; internet posting).
A simple random generator using MWC, CONG, and SHR3 by George Marsaglia (1999; internet posting)...
virtual std::string to_string() const
A subtract with borrow random number generator by George Marsaglia (1999; internet posting)...
A random number generator combining several techniques by George Marsaglia (1999; internet posting)...