Module: Essential Math Group: Statistics classes
Does not inherit
deepenShallowCopy() operator() operator=() |
printOn() reference() restart() |
restoreFrom() RWRandGenerator() saveOn() |
scanFrom() |
#include <rw/randgen.h> RWRandGenerator gen;
Class RWRandGenerator generates random numbers uniformly distributed over the interval [0, 1]. RWRandGenerator objects can be independent or share state with each other. The Essential Math Module contains a global default state that is shared by all generators created with the default constructor. Using the default generator state does not guarantee repeatable sequences, even if you restart() it using a specific seed. This is because the global state may be shared among several applications in a multithreaded environment. There is no protection against multiple threads of control using the global default state at the same time. To achieve repeatable sequences, you must construct a generator with a specific seed value and use the generator for random number generation.
RWRandGenerator();
Constructs a generator with the shared global default state.
RWRandGenerator(const RWRandGenerator& x);
Constructs a copy of x. The generators share state.
RWRandGenerator(long seed);
Constructs a generator with specified initial seed. The generator has its own state.
void deepenShallowCopy();
Makes the state independent, but doesn't change it.
void restart();
Restarts the generator with a random seed.
void restart(long seed);
Restarts the generator with the specified seed.
void reference(const RWRandGenerator& x);
Sets state to argument's state.
double operator()();
Returns a random double in [0, 1].
RWRandGenerator& operator=(const RWRandGenerator& x);
Sets state to argument's state.
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 RWRandGenerator& rgen);
Outputs a summary of rgen's internal state on ostream s.
std::istream& rwmathexport operator>> (std::istream& s, RWRandGenerator& 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.