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

Default RandomGenerator constructor

Parameters
sseed

◆ ~RandomGenerator()

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

◆ RandomGenerator() [2/3]

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

◆ RandomGenerator() [3/3]

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

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.

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

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

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ 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: