World Ocean Simulation System (WOSS) library
woss::RandomGenerator Class Reference

woss::RandomGenerator class More...

#include <random-generator-definitions.h>

Inheritance diagram for woss::RandomGenerator:
Inheritance graph
Collaboration diagram for woss::RandomGenerator:
Collaboration graph

Public Member Functions

 RandomGenerator (int s=0)
 
virtual ~RandomGenerator ()
 
virtual RandomGeneratorcreate (double seed)
 
virtual RandomGeneratorclone () const
 
virtual bool isValid () const
 
virtual void setSeed (int s)
 
virtual int getSeed () const
 
virtual void initialize ()
 
virtual double getRand () const
 
virtual int getRandInt () const
 

Protected Attributes

int seed
 
bool initialized
 

Detailed Description

woss::RandomGenerator class

Class for random value generation purposes

Constructor & Destructor Documentation

◆ RandomGenerator()

woss::RandomGenerator::RandomGenerator ( int  s = 0)
inline

Default RandomGenerator constructor

Parameters
sseed

Referenced by clone(), and create().

◆ ~RandomGenerator()

virtual woss::RandomGenerator::~RandomGenerator ( )
inlinevirtual

Default destructor

Member Function Documentation

◆ clone()

virtual RandomGenerator * woss::RandomGenerator::clone ( ) const
inlinevirtual

RandomGenerator virtual factory method

Returns
a heap-allocated RandomGenerator copy of this instance

Reimplemented in WossRandomGenerator.

References RandomGenerator().

Referenced by woss::DefHandler::operator=().

Here is the call graph for this function:

◆ create()

virtual RandomGenerator * woss::RandomGenerator::create ( double  seed)
inlinevirtual

RandomGenerator virtual factory method

Parameters
copyRandomGenerator to be copied
Returns
a heap-allocated RandomGenerator object

References RandomGenerator(), and seed.

Here is the call graph for this function:

◆ getRand()

double RandomGenerator::getRand ( ) const
virtual

Gets a random value

Returns
a random value between 0 and 1

Reimplemented in WossRandomGenerator.

References initialized.

Referenced by woss::DefHandler::getRand().

◆ getRandInt()

int RandomGenerator::getRandInt ( ) const
virtual

Gets a random integer value

Returns
a random integer

Reimplemented in WossRandomGenerator.

References initialized.

Referenced by woss::DefHandler::getRandInt().

◆ getSeed()

virtual int woss::RandomGenerator::getSeed ( ) const
inlinevirtual

Sets the seed

Returns
the seed

References seed.

◆ initialize()

void RandomGenerator::initialize ( )
virtual

Mandatory function to initialize the instance

Reimplemented in WossRandomGenerator.

References initialized, and seed.

◆ isValid()

virtual bool woss::RandomGenerator::isValid ( ) const
inlinevirtual

Checks the validity of RandomGenerator

Returns
true if initialized, false otherwise

References initialized.

◆ setSeed()

virtual void woss::RandomGenerator::setSeed ( int  s)
inlinevirtual

Sets the seed

Parameters
sseed

References seed.

Member Data Documentation

◆ initialized

bool woss::RandomGenerator::initialized
protected

◆ seed

int woss::RandomGenerator::seed
protected

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