rwlogo
SourcePro 11.1

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWRandGenR250 Class Reference
[Statistics]

Generates random numbers uniformly distributed over the interval [0, 1]. More...

#include <rw/randr250.h>

List of all members.

Public Member Functions

 RWRandGenR250 ()
 RWRandGenR250 (unsigned long seed)
 RWRandGenR250 (const RWRandGenR250 &u)
double operator() ()
unsigned long seed () const
void restart ()
void restart (unsigned long seed)
void operator= (const RWRandGenR250 &u)
bool operator== (const RWRandGenR250 &u) const
bool operator!= (const RWRandGenR250 &u) const
void printOn (std::ostream &s) const
void scanFrom (std::istream &s)
void restoreFrom (RWFile &)
void restoreFrom (RWvistream &)
void saveOn (RWFile &) const
void saveOn (RWvostream &) 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)

Detailed Description

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).

Synopsis

 #include <rw/randr250.h>
 RWRandGenR250 gen;

Constructor & Destructor Documentation

RWRandGenR250::RWRandGenR250 (  ) 

Constructs a generator, abitrarily 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.


Member Function Documentation

bool RWRandGenR250::operator!= ( const RWRandGenR250 u  )  const

Returns true for two distinct instances of RWRandGenR250 if their interal states differ. "(x != x)" returns false.

double RWRandGenR250::operator() (  ) 

Returns a random double in [0,1].

void 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 ( unsigned long  seed  ) 

Restarts the generator with specified seed.

void RWRandGenR250::restart (  ) 

Restarts the generator, abitrarily seeding it by a call to the time() function.

void RWRandGenR250::restoreFrom ( RWvistream  ) 

Restores internal state of self from a virtual stream.

void RWRandGenR250::restoreFrom ( RWFile  ) 

Restores internal state of self from an RWFile.

void RWRandGenR250::saveOn ( RWvostream  )  const

Stores internal state of self to a virtual stream.

void RWRandGenR250::saveOn ( RWFile  )  const

Stores internal state of self in a binary format to an RWFile.

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.


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  s,
const RWRandGenR250 gen 
) [related]

Outputs a summary of gen's internal state on ostream s.

std::istream & operator>> ( std::istream &  s,
RWRandGenR250 gen 
) [related]

Inputs an internal state from istream s to gen.


© 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.