Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cRandomFloat Class Reference

#include <cRandomFloat.h>

Inheritance diagram for GrayLib::cRandomFloat:
Gray::cRandomBase Gray::IRandomNoise GrayLib::cRandomBGenerator GrayLib::cRandomCombo2< _TYPE1, _TYPE2 > GrayLib::cRandomFloatDef GrayLib::cRandomMersenne GrayLib::cRandomWGenerator

Public Member Functions

virtual double get_RandDouble ()
 the default random number generator. More...
 
virtual float get_RandFloat ()
 
double GetRandDX (double nScale)
 
float GetRandFX (float nScale)
 
float GetRandFRange (float fRangeLo, float fRangeHi)
 
 UNITTEST_FRIEND (cRandomFloat)
 
- Public Member Functions inherited from Gray::cRandomBase
 cRandomBase () noexcept
 
virtual ~cRandomBase ()
 
virtual void InitSeed (const void *pData, size_t iSize)=0
 
void InitSeed (IRandomNoise *pSrc, size_t iSize)
 the default random number generator. NOT Thread Safe! More...
 
void InitSeedDefault (size_t iSize=sizeof(int))
 
void InitSeedUns (UINT iSeed)
 
virtual HRESULT GetNoise (void *pData, size_t iSize) override
 fill array with random. return # filled. More...
 
virtual UINT get_RandUns ()
 
bool GetRandBool ()
 
virtual UINT GetRandUX (UINT nScale)
 
int GetRandIRange (int iRangeLo, int iRangeHi)
 

Additional Inherited Members

- Public Types inherited from Gray::cRandomBase
typedef UINT SEED_t
 default seed size might be 32 or 64 bit depending on k_RAND_MAX. More...
 

Detailed Description

Base for floating point pseudo random number generators. implement shaped random distributions.

Note
derived class MUST implement get_RandUns or GetRandUX

Member Function Documentation

◆ get_RandDouble()

double GrayLib::cRandomFloat::get_RandDouble ( )
virtual

the default random number generator.

Build random float from unsigned number.

Returns
a floating point random number in the interval 0 <= x < 1. pack IEEE float64 http://en.wikipedia.org/wiki/IEEE_754-1985 64 bit float = 11 exponent bits + 52 fraction bits.

Reimplemented in GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >.

◆ get_RandFloat()

float GrayLib::cRandomFloat::get_RandFloat ( )
virtual

Build random float from unsigned number.

Returns
a floating point random number in the interval 0 <= x < 1. pack IEEE float32 http://en.wikipedia.org/wiki/IEEE_754-1985 32 bit float = 8 exponent bits + 23 fraction bits.

◆ GetRandDX()

double GrayLib::cRandomFloat::GetRandDX ( double  nScale)
inline

Get a float 0 to nScale

Returns
from 0 to < nScale

◆ GetRandFRange()

float GrayLib::cRandomFloat::GetRandFRange ( float  fRangeLo,
float  fRangeHi 
)

default implementation. Non inclusive range

◆ GetRandFX()

float GrayLib::cRandomFloat::GetRandFX ( float  nScale)
inline

Get a float 0 to nScale

Returns
from 0 to < nScale

◆ UNITTEST_FRIEND()

GrayLib::cRandomFloat::UNITTEST_FRIEND ( cRandomFloat  )

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