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 ()=default
 RandomGenerator (const RandomGenerator &copy)=default
 RandomGenerator (RandomGenerator &&tmp)=default
RandomGeneratoroperator= (const RandomGenerator &copy)=default
RandomGeneratoroperator= (RandomGenerator &&tmp)=default
virtual std::unique_ptr< RandomGeneratorcreate (int seed) const
virtual std::unique_ptr< 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 = 0
bool initialized = false

Detailed Description

woss::RandomGenerator class

Class for random value generation purposes

Constructor & Destructor Documentation

◆ RandomGenerator() [1/3]

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

◆ ~RandomGenerator()

virtual woss::RandomGenerator::~RandomGenerator ( )
virtualdefault

◆ RandomGenerator() [2/3]

woss::RandomGenerator::RandomGenerator ( const RandomGenerator & copy)
default

References RandomGenerator().

Here is the call graph for this function:

◆ RandomGenerator() [3/3]

woss::RandomGenerator::RandomGenerator ( RandomGenerator && tmp)
default

References RandomGenerator().

Here is the call graph for this function:

Member Function Documentation

◆ clone()

virtual std::unique_ptr< RandomGenerator > woss::RandomGenerator::clone ( ) const
inlinevirtual

RandomGenerator virtual factory method

Returns
std::unique_ptr to a heap-allocated RandomGenerator copy of this instance

Reimplemented in WossRandomGenerator.

Referenced by WossUnitTest::testRandomGenerator().

◆ create()

virtual std::unique_ptr< RandomGenerator > woss::RandomGenerator::create ( int seed) const
inlinevirtual

RandomGenerator virtual factory method

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

Reimplemented in WossRandomGenerator.

References seed.

◆ 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 WossUnitTest::testRandomGenerator().

◆ getRandInt()

int RandomGenerator::getRandInt ( ) const
virtual

Gets a random integer value

Returns
a random integer

Reimplemented in WossRandomGenerator.

References initialized.

◆ getSeed()

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

Sets the seed

Returns
the seed

References seed.

Referenced by WossUnitTest::testRandomGenerator().

◆ initialize()

void RandomGenerator::initialize ( )
virtual

Mandatory function to initialize the instance

Reimplemented in WossRandomGenerator.

References initialized, and seed.

Referenced by WossUnitTest::testRandomGenerator().

◆ isValid()

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

Checks the validity of RandomGenerator

Returns
true if initialized, false otherwise

References initialized.

Referenced by WossUnitTest::testRandomGenerator().

◆ operator=() [1/2]

RandomGenerator & woss::RandomGenerator::operator= ( const RandomGenerator & copy)
default

References RandomGenerator().

Here is the call graph for this function:

◆ operator=() [2/2]

RandomGenerator & woss::RandomGenerator::operator= ( RandomGenerator && tmp)
default

References RandomGenerator().

Here is the call graph for this function:

◆ setSeed()

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

Sets the seed

Parameters
sseed

References seed.

Referenced by WossRandomGeneratorTcl::WossRandomGeneratorTcl().

Member Data Documentation

◆ initialized

◆ seed


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