EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
Public Member Functions | Protected Member Functions | List of all members
EGS_Ranmar Class Reference

A ranmar RNG class. More...

Inheritance diagram for EGS_Ranmar:
EGS_RandomGenerator

Public Member Functions

 EGS_Ranmar (int ixx=1802, int jxx=9373, int n=128)
 Construct a ranmar RNG using ixx and jxx as the initial seeds.
 
 EGS_Ranmar (const EGS_Ranmar &r)
 
void fillArray (int n, EGS_Float *array)
 Fill the array pointed to by array with random numbers.
 
void describeRNG () const
 Output information about this RNG using egsInformation()
 
EGS_RandomGeneratorgetCopy ()
 
void setState (EGS_RandomGenerator *r)
 
void saveState ()
 
void resetState ()
 
int rngSize () const
 
void setHighResolution (bool hr)
 
- Public Member Functions inherited from EGS_RandomGenerator
 EGS_RandomGenerator (int n=128)
 Construct a RNG that has an array of n points to hold random numbers. More...
 
 EGS_RandomGenerator (const EGS_RandomGenerator &r)
 Copy constructor. More...
 
virtual ~EGS_RandomGenerator ()
 Destructor. More...
 
EGS_Float getUniform ()
 Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive). More...
 
EGS_I64 numbersGenerated () const
 Returns the number of random numbers generated so far. More...
 
EGS_I64 numbersUsed () const
 Returns the number of random numbers used so far. More...
 
void getAzimuth (EGS_Float &cphi, EGS_Float &sphi)
 Sets cphi and sphi to the cosine and sine of a random angle uniformely distributed between 0 and $2 \pi $. More...
 
EGS_Float getGaussian ()
 Returns a Gaussian distributed random number with mean zero and standard deviation 1.
 
bool storeState (ostream &data)
 Functions for storing, seting and reseting the state of a RNG object. More...
 
bool setState (istream &data)
 
bool addState (istream &data)
 
void resetCounter ()
 

Protected Member Functions

bool storePrivateState (ostream &data)
 
bool setPrivateState (istream &data)
 
void set (const EGS_Ranmar &r)
 
- Protected Member Functions inherited from EGS_RandomGenerator
void copyBaseState (const EGS_RandomGenerator &r)
 
void allocate (int n)
 
int baseSize () const
 The memory needed to store the base state.
 

Additional Inherited Members

- Static Public Member Functions inherited from EGS_RandomGenerator
static EGS_RandomGeneratorcreateRNG (EGS_Input *inp, int sequence=0)
 Create a RNG object from the information pointed to by inp and return a pointer to it. More...
 
static EGS_RandomGeneratordefaultRNG (int sequence=0)
 Returns a pointer to the default egspp RNG. More...
 
- Protected Attributes inherited from EGS_RandomGenerator
EGS_I64 count
 random number generated so far
 
int np
 size of the array rarray
 
int ip
 pointer to the next rarray element in the sequence
 
EGS_Float * rarray
 array with random numbers of size np.
 

Detailed Description

A ranmar RNG class.

This RNG class implements the Zaman & Marsaglia ranmar generator. ranmar has been the default EGS4 and EGSnrc RNG for many years.

Definition at line 137 of file egs_rndm.cpp.

Member Function Documentation

bool EGS_Ranmar::storePrivateState ( ostream &  data)
protectedvirtual

Stores the pointers ix and jx, the carry c, the initial seeds that were used to initialize the generator and the 97 element array u.

Implements EGS_RandomGenerator.

Definition at line 264 of file egs_rndm.cpp.

bool EGS_Ranmar::setPrivateState ( istream &  data)
protectedvirtual

Reads the same data stored by storePrivateState()

Implements EGS_RandomGenerator.

Definition at line 274 of file egs_rndm.cpp.


The documentation for this class was generated from the following file: