Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cRandomCombo2< _TYPE1, _TYPE2 > Class Template Reference

#include <cRandomCombo.h>

Inheritance diagram for GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >:
GrayLib::cRandomFloat Gray::cRandomBase Gray::IRandomNoise

Public Member Functions

 cRandomCombo2 (const void *pData, size_t iSize)
 
virtual ~cRandomCombo2 ()
 
virtual void InitSeed (const void *pData, size_t iSize) override
 
virtual double get_RandDouble () override
 the default random number generator. More...
 
virtual UINT GetRandUX (UINT nScale) override
 
- Public Member Functions inherited from GrayLib::cRandomFloat
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 ()
 
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 ()
 
int GetRandIRange (int iRangeLo, int iRangeHi)
 

Public Attributes

_TYPE1 m_r1
 
_TYPE2 m_r2
 

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

template<class _TYPE1, class _TYPE2>
class GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >

class for combining two different floating point based random number generators. A combination of two random number generators is generally better than any of the two alone. The two generators should preferably be of very different design. For cryptographic random usage.

Constructor & Destructor Documentation

◆ cRandomCombo2()

template<class _TYPE1 , class _TYPE2 >
GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::cRandomCombo2 ( const void *  pData,
size_t  iSize 
)
inline

◆ ~cRandomCombo2()

template<class _TYPE1 , class _TYPE2 >
virtual GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::~cRandomCombo2 ( )
inlinevirtual

Member Function Documentation

◆ get_RandDouble()

template<class _TYPE1 , class _TYPE2 >
virtual double GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::get_RandDouble ( )
inlineoverridevirtual

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 from GrayLib::cRandomFloat.

◆ GetRandUX()

template<class _TYPE1 , class _TYPE2 >
virtual UINT GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::GetRandUX ( UINT  nScale)
inlineoverridevirtual

Get random number in scale. 0 to scale. unsigned integer is NON inclusive range. from 0 to nScale-1

output random integer get integer random number in desired interval

get random integer number in 0 to < nScale range NON inclusive default implementation.

Note
derived implementation MUST override get_RandUns() or GetRandUX()

Reimplemented from Gray::cRandomBase.

◆ InitSeed()

template<class _TYPE1 , class _TYPE2 >
virtual void GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::InitSeed ( const void *  pData,
size_t  iSize 
)
inlineoverridevirtual

re-seed

Implements Gray::cRandomBase.

Member Data Documentation

◆ m_r1

template<class _TYPE1 , class _TYPE2 >
_TYPE1 GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::m_r1

◆ m_r2

template<class _TYPE1 , class _TYPE2 >
_TYPE2 GrayLib::cRandomCombo2< _TYPE1, _TYPE2 >::m_r2

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