SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Generates random numbers uniformly distributed over the interval [0, 1]
.
More...
#include <rw/randr250.h>
Public Member Functions | |
RWRandGenR250 () | |
RWRandGenR250 (unsigned long seed) | |
RWRandGenR250 (const RWRandGenR250 &u) | |
bool | operator!= (const RWRandGenR250 &u) const |
double | operator() () |
RWRandGenR250 & | operator= (const RWRandGenR250 &u) |
bool | operator== (const RWRandGenR250 &u) const |
void | printOn (std::ostream &s) const |
void | restart () |
void | restart (unsigned long seed) |
void | restoreFrom (RWFile &) |
void | restoreFrom (RWvistream &) |
void | saveOn (RWFile &) const |
void | saveOn (RWvostream &) const |
void | scanFrom (std::istream &s) |
unsigned long | seed () const |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &s, const RWRandGenR250 &gen) |
std::istream & | operator>> (std::istream &s, RWRandGenR250 &gen) |
Class RWRandGenR250 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. RWRandGenR250 is a generalized feedback shift register generator.
Unlike class RWRandGenerator, each instance of RWRandGenR250 contains and maintains its own, independent state. This can make it easier to use in some situations. The "internal state" of an instance of RWRandGenR250 consists of a seed, an array of unsigned longs known as the "state vector" and an integer index into that state vector. (S. Kirkpatrick and E. Stoll, Journal of Computational Physics, 40, p. 517 (1981).
RWRandGenR250::RWRandGenR250 | ( | ) |
Constructs a generator, arbitrarily seeded by a call to the time() function.
RWRandGenR250::RWRandGenR250 | ( | unsigned long | seed | ) |
Constructs a generator with a specified seed.
RWRandGenR250::RWRandGenR250 | ( | const RWRandGenR250 & | u | ) |
Constructs a copy of u. The copy's state will equal the state of u at the time the copy is created, but will not share the state of u.
bool RWRandGenR250::operator!= | ( | const RWRandGenR250 & | u | ) | const |
Returns true
for two distinct instances of RWRandGenR250 if their internal states differ. "(x != x)
" returns false
.
double RWRandGenR250::operator() | ( | ) |
Returns a random double in [0,1]
.
RWRandGenR250& RWRandGenR250::operator= | ( | const RWRandGenR250 & | u | ) |
Sets an instance of RWRandGenR250 equal to the state of instance u.
bool RWRandGenR250::operator== | ( | const RWRandGenR250 & | u | ) | const |
Returns true
for two distinct instances of RWRandGenR250 if they will return identical sequences of values.
void RWRandGenR250::printOn | ( | std::ostream & | s | ) | const |
Outputs a summary of self's internal state on ostream s.
void RWRandGenR250::restart | ( | ) |
Restarts the generator, arbitrarily seeding it by a call to the time() function.
void RWRandGenR250::restart | ( | unsigned long | seed | ) |
Restarts the generator with specified seed.
void RWRandGenR250::restoreFrom | ( | RWvistream & | ) |
Restores internal state of self from a virtual stream.
void RWRandGenR250::saveOn | ( | RWFile & | ) | const |
Stores internal state of self in a binary format to an RWFile.
void RWRandGenR250::saveOn | ( | RWvostream & | ) | const |
Stores internal state of self to a virtual stream.
void RWRandGenR250::scanFrom | ( | std::istream & | s | ) |
Inputs an internal state from istream s to self.
unsigned long RWRandGenR250::seed | ( | ) | const |
Returns the seed used to initialize the generator.
|
related |
Outputs a summary of gen's internal state on ostream s.
|
related |
Inputs an internal state from istream s to gen.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |