Module: Essential Math Group: Statistics classes
Does not inherit
long seed() operator!=() operator() |
operator=() operator==() printOn() |
restart() restoreFrom() RWRandGenMRG32K3A() |
saveOn() scanFrom() |
#include <rw/randmrg32k3a.h> RWRandGenMRG32K3A gen;
Class RWRandMRG32K3A generates random numbers uniformly distributed over the interval [0, 1], and may be used instead of class RWRandGenerator as a template parameter to any of the distribution generators derived from abstract base class RWTRand<>. RWRandGenMRG32K3A is a combined multiple recursive generator with two components of order 3.
xn = a11xn-1 + a12xn-2 + a13xn-3(mod m1)
yn = a21yn-1 + a22yn-2 + a23yn-3(mod m2)
zn = xn - yn(mod m1)
un = zn/m1
a11 = 0, a12 = 1403580, a13 = -810728, m1 = 232 - 209
Unlike class RWRandGenerator, each instance of RWRandGenMRG32K3A contains and maintains its own, independent state. This can make it easier to use in some situations. The "internal state" of an instance of RWRandGenMRG32K3A consists of a seed and a series of six integers.
RWRandGenMRG32K3A();
Constructs a generator, abitrarily seeded by a call to the time() function.
RWRandGenMRG32K3A(const RWRandGenMRG32K3A& x);
Constructs a copy of x. The copy's state will equal x's state at the time the copy is created, but will not share x's state.
RWRandGenMRG32K3A(unsigned long seed);
Constructs a generator with a specified seed.
unsigned long seed() const;
Returns the seed used to initialize the generator.
void restart();
Restarts the generator, abitrarily seeding it by a call to the time() function.
void restart(unsigned long seed);
Restarts the generator with specified seed.
double operator()();
Returns a random double in [0,1].
void operator=(const RWRandGenMRG32K3A& x);
Sets an instance of RWRandGenMRG32K3A equal to the state of instance x.
bool operator==(const RWRandGenMRG32K3A& x) const;
Returns true for two distinct instances of RWRandGenMRG32K3A if they will return identical sequences of values.
bool operator!=(const RWRandGenMRG32K3A& x) const;
Returns true for two distinct instances of RWRandGenMRG32K3A if their interal states differ.
"(x != x)" returns false.
void printOn(std::ostream& s) const;
Outputs a summary of self's internal state on ostream s.
void scanFrom(std::istream& s);
Inputs an internal state from istream s to self.
void restoreFrom(RWvistream&); void restoreFrom(RWFile&);
Restores internal state of self from a virtual stream or an RWFile.
void saveOn(RWvostream&) const; void saveOn(RWFile&) const;
Stores internal state of self to a virtual stream or in a binary format to an RWFile or RWvostream.
std::ostream& rwmathexport operator<< (std::ostream& s, const RWRandGenMRG32K3A& rgen);
Outputs a summary of rgen's internal state on ostream s.
std::istream& rwmathexport operator>> (std::istream& s, RWRandGenMRG32K3A& rgen);
Inputs an internal state from istream s to rgen.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.