Ocular Engine
Ocular::Math::Random::ARandom Class Referenceabstract

#include <ARandom.hpp>

Inheritance diagram for Ocular::Math::Random::ARandom:
Ocular::Math::Random::CMWC131104 Ocular::Math::Random::MersenneTwister127 Ocular::Math::Random::MersenneTwister19937 Ocular::Math::Random::WELL512 Ocular::Math::Random::XorShift96

Public Member Functions

uint32_t operator() ()
void seed ()
virtual void seed (int64_t seed)
virtual uint32_t next ()=0
virtual uint32_t next (uint32_t min, uint32_t max)
virtual float nextf (float precision=0.0001f)
virtual float nextf (float min, float max, float precision=0.0001f)
virtual int32_t nextSigned ()
virtual int32_t nextSigned (int32_t min, int32_t max)
virtual uint32_t min ()
virtual uint32_t max ()

Protected Attributes

int64_t m_Seed

Detailed Description

Default interface for Ocular pseudo-random number generator implementations. These generators support both integer and floating point output and can automatically constrain them to a specified range.

All implementations provide uniform output distribution. If a specific distribution is required, such as gaussian, poisson, exponential, etc. then these generators may be used with the STL distribution templates. Example:

#include <random>

using namespace Ocular::Math::Random;
using namespace std;

void foo()
    MersenneTwister19937 generator;
    poisson_distribution<uint32_t> distribution(10);

    uint32_t value = distribution(generator);

Member Function Documentation

uint32_t Ocular::Math::Random::ARandom::max ( )

Retrieves the minimum value generated by this PRNG. Default of UINT32_MAX.

uint32_t Ocular::Math::Random::ARandom::min ( )

Retrieves the minimum value generated by this PRNG. Default of 0.

virtual uint32_t Ocular::Math::Random::ARandom::next ( )
pure virtual
uint32_t Ocular::Math::Random::ARandom::next ( uint32_t  min,
uint32_t  max 

Retrieves the next pseudo-random number and fits it inside of the specified bounds (this is not a clamp)

[in]minMinimum value for the random number
[in]maxMaximum value for the random number
float Ocular::Math::Random::ARandom::nextf ( float  precision = 0.0001f)

Retrieves the next pseudo-random number as a float in the the range of [0.0, 1.0]. The precision dictates the, well uh, precision of the returned value.

float Ocular::Math::Random::ARandom::nextf ( float  min,
float  max,
float  precision = 0.0001f 

Retrieves the next pseudo-random number as a float in the specified range of [min, max].

[in]minMinimum value to be returned.
[in]maxMaximum value to be returned.
uint32_t Ocular::Math::Random::ARandom::operator() ( )

Identical to ARandom::next

void Ocular::Math::Random::ARandom::seed ( )

Seeds the PRNG with the current epoch time (NS)

void Ocular::Math::Random::ARandom::seed ( int64_t  seed)

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