panga
Public Member Functions | Protected Member Functions | List of all members
panga::RandomWrapper Class Reference

#include <RandomWrapper.h>

Public Member Functions

 RandomWrapper (const RandomWrapper &rhs)=delete
 
RandomWrapperoperator= (const RandomWrapper &rhs)=delete
 
template<typename IntegerType = uint32_t>
IntegerType RandomInteger (IntegerType min, IntegerType max)
 
template<typename FloatType = double>
FloatType RandomFloat (FloatType min, FloatType max)
 
bool CoinFlip (double probability)
 
std::byte RandomByte ()
 

Protected Member Functions

std::mt19937 & Engine ()
 

Detailed Description

A simple wrapper which may be used to generate random values.

Member Function Documentation

◆ CoinFlip()

bool panga::RandomWrapper::CoinFlip ( double  probability)

Generates a weighted coin flip with |probability| chance of producing the value true.

◆ RandomByte()

std::byte panga::RandomWrapper::RandomByte ( )

Generates a uniformly random byte.

◆ RandomFloat()

template<typename FloatType = double>
FloatType panga::RandomWrapper::RandomFloat ( FloatType  min,
FloatType  max 
)
inline

Generates a uniformly random floating point value of type |FloatType| in the range [|min|, |max|).

◆ RandomInteger()

template<typename IntegerType = uint32_t>
IntegerType panga::RandomWrapper::RandomInteger ( IntegerType  min,
IntegerType  max 
)
inline

Generates a uniformly random integer of type |IntegerType| in the range [|min|, |max|].


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