Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::MTRandom32 Class Referencefinal

Mersenne Twister random number generator algorithm. More...

#include <mtrandom.h>

Inheritance diagram for hgps::MTRandom32:
[legend]
Collaboration diagram for hgps::MTRandom32:
[legend]

Public Member Functions

 MTRandom32 ()
 Initialise a new instance of the MTRandom32 class. More...
 
 MTRandom32 (const unsigned int seed)
 Initialise a new instance of the MTRandom32 class. More...
 
unsigned int operator() () override
 Generates the next random number. More...
 
void seed (const unsigned int) override
 Sets the current state of the generator engine. More...
 
void discard (const unsigned long long skip) override
 Advances the engine's state by a specified amount. More...
 
double next_double () noexcept override
 Generates a random floating point number in range [0,1) More...
 
- Public Member Functions inherited from hgps::RandomBitGenerator
virtual ~RandomBitGenerator ()=default
 Destroys a RandomBitGenerator instance. More...
 

Static Public Member Functions

static constexpr unsigned int min ()
 Gets the smallest possible value in the output range. More...
 
static constexpr unsigned int max ()
 Gets the largest possible value in the output range. More...
 
- Static Public Member Functions inherited from hgps::RandomBitGenerator
static constexpr result_type min ()
 Gets the smallest possible value in the output range. More...
 
static constexpr result_type max ()
 Gets the largest possible value in the output range. More...
 

Additional Inherited Members

- Public Types inherited from hgps::RandomBitGenerator
using result_type = unsigned int
 

Detailed Description

Mersenne Twister random number generator algorithm.

Constructor & Destructor Documentation

◆ MTRandom32() [1/2]

hgps::MTRandom32::MTRandom32 ( )

Initialise a new instance of the MTRandom32 class.

◆ MTRandom32() [2/2]

hgps::MTRandom32::MTRandom32 ( const unsigned int  seed)
explicit

Initialise a new instance of the MTRandom32 class.

Parameters
seedThe value to initialise the internal state
Here is the call graph for this function:

Member Function Documentation

◆ discard()

void hgps::MTRandom32::discard ( const unsigned long long  skip)
overridevirtual

Advances the engine's state by a specified amount.

Parameters
skipThe number of times to advance the state

Implements hgps::RandomBitGenerator.

Here is the caller graph for this function:

◆ max()

static constexpr unsigned int hgps::MTRandom32::max ( )
inlinestaticconstexpr

Gets the largest possible value in the output range.

Returns
The maximum potentially generated value.

◆ min()

static constexpr unsigned int hgps::MTRandom32::min ( )
inlinestaticconstexpr

Gets the smallest possible value in the output range.

Returns
The minimum potentially generated value.

◆ next_double()

double hgps::MTRandom32::next_double ( )
overridevirtualnoexcept

Generates a random floating point number in range [0,1)

Returns
A floating point value in range [0,1).

Implements hgps::RandomBitGenerator.

◆ operator()()

unsigned int hgps::MTRandom32::operator() ( )
overridevirtual

Generates the next random number.

Returns
A pseudo-random number value in [min(), max()]

Implements hgps::RandomBitGenerator.

◆ seed()

void hgps::MTRandom32::seed ( const unsigned int  seed)
overridevirtual

Sets the current state of the generator engine.

Parameters
seedThe value to initialise the internal state

Implements hgps::RandomBitGenerator.

Here is the caller graph for this function:

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