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

#include <SequentialRandomEngine.h>

Inheritance diagram for SequentialRandomEngine:
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

unsigned _state = 0
 

Member Function Documentation

◆ peek()

virtual int SequentialRandomEngine::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 SequentialRandomEngine::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 SequentialRandomEngine::randomFloat ( )
inlineoverridevirtual
Returns
Random floating point number in range [0, 1).

Implements RandomEngine.

◆ seed()

virtual void SequentialRandomEngine::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

◆ _state

unsigned SequentialRandomEngine::_state = 0
private

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