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

#include <TracingRandomEngine.h>

Inheritance diagram for TracingRandomEngine:
RandomEngine

Public Member Functions

 TracingRandomEngine (Platform *platform, RandomEngine *base)
 
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 Member Functions

template<class T >
void printTrace (const char *function, const T &value) const
 

Private Attributes

Platform_platform = nullptr
 
RandomEngine_base = nullptr
 

Constructor & Destructor Documentation

◆ TracingRandomEngine()

TracingRandomEngine::TracingRandomEngine ( Platform platform,
RandomEngine base 
)
explicit

Member Function Documentation

◆ peek()

int TracingRandomEngine::peek ( int  hi) const
overridevirtual

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.

◆ printTrace()

template<class T >
void TracingRandomEngine::printTrace ( const char *  function,
const T &  value 
) const
private

◆ random()

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

Implements RandomEngine.

◆ randomFloat()

float TracingRandomEngine::randomFloat ( )
overridevirtual
Returns
Random floating point number in range [0, 1).

Implements RandomEngine.

◆ seed()

void TracingRandomEngine::seed ( int  seed)
overridevirtual

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

RandomEngine* TracingRandomEngine::_base = nullptr
private

◆ _platform

Platform* TracingRandomEngine::_platform = nullptr
private

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