Module: Essential Math Group: Statistics classes
Does not inherit
#include <rw/randmcg31m1.h> RWRandGenMCG31M1 gen;
Class RWRandGenMCG31M1 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<>.
RWRandGenMCG31M1 is a 31-bit multiplicative congruential generator.
xn = axn-1(mod m)
un = xn/m
a = 1132489760, m = 231 - 1
Unlike RWRandGenerator, each instance of RWRandGenMCG31M1 contains and maintains its own, independent state. This can make it easier to use in some situations. The "internal state" of an instance of RWRandGenMCG31M1 consists of only a seed.
RWRandGenMCG31M1();
Constructs a generator, abitrarily seeded by a call to the time() function.
RWRandGenMCG31M1(const RWRandGenMCG31M1& 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.
RWRandGenMCG31M1(unsigned long seed)
Constructs a generator with a specified seed.
double operator()();
Returns a random double in [0,1].
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 RWRandGenMCG31M1& rgen);
Outputs a summary of rgen's internal state on ostream s.
std::istream& rwmathexport operator>> (std::istream& s, RWRandGenMCG31M1& 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.