OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MersenneTwisterRandomEngine Class Reference

#include <MersenneTwisterRandomEngine.h>

Inheritance diagram for MersenneTwisterRandomEngine:
RandomEngine

Public Member Functions

virtual float randomFloat () override
 
virtual int random (int hi) override
 
virtual int peek (int hi) const override
 
virtual void seed (int seed) override
 
- Public Member Functions inherited from RandomEngine
virtual ~RandomEngine ()=default
 
virtual float randomFloat ()=0
 
virtual int random (int hi)=0
 
virtual int peek (int hi) const =0
 
virtual void seed (int seed)=0
 
int randomInSegment (int min, int max)
 
int randomDice (int count, int faces)
 
bool randomBool ()
 
template<class Range , class T = typename Range::value_type>
randomSample (const Range &range)
 
template<class T >
randomSample (std::initializer_list< T > range)
 

Private Attributes

std::mt19937 _base
 

Member Function Documentation

◆ peek()

virtual int MersenneTwisterRandomEngine::peek ( int  hi) const
inlineoverridevirtual

Note that this method is mainly for debugging, implementation is not required to be efficient.

Parameters
hiUpper bound for the result. Must be greater than zero.
Returns
Random number that the next call to random(hi) will return.

Implements RandomEngine.

◆ random()

virtual int MersenneTwisterRandomEngine::random ( int  hi)
inlineoverridevirtual
Parameters
hiUpper bound for the result. Must be greater than zero.
Returns
Random number in range [0, hi).

Implements RandomEngine.

◆ randomFloat()

virtual float MersenneTwisterRandomEngine::randomFloat ( )
inlineoverridevirtual
Returns
Random floating point number in range [0, 1).

Implements RandomEngine.

◆ seed()

virtual void MersenneTwisterRandomEngine::seed ( int  seed)
inlineoverridevirtual

Reinitializes this random engine with the provided seed value. Passing 0 should be equivalent to calling an in-place destructor and then reconstructing the object.

Parameters
seedRandom seed.

Implements RandomEngine.

Member Data Documentation

◆ _base

std::mt19937 MersenneTwisterRandomEngine::_base
private

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