DUNE: Uniform Navigational Environment  2017.01.0
DUNE::Math::Random::KernelDevice Class Reference

Detailed Description

A RNG based on the use of special character device '/dev/urandom' ('/dev/random' is not considered due to possible blocking behavior).

Usually it provide true RNG or high performance pseudo-RNG e.g. for chryptographic applications.

IMPORTANT NOTES:

  • Use other generator instances in this namespace for portable, repeatable and lightweight RNG with sufficient quality for run-of-the-mill applications since:
    • Speed can be one or more orders of magnitude slower than other RNGs in this namespace.
    • Behavior is OS-dependent.
    • You cannot seed the RNG, and it should be (truly or highly) non-deterministic
      • use it for unrepeatable behavior :)

Public Member Functions

 KernelDevice ()
 
 ~KernelDevice ()
 
int32_t random (void)
 
double uniform (void)
 
void seed (int32_t value)
 
- Public Member Functions inherited from DUNE::Math::Random::Generator
virtual ~Generator ()
 
double uniform (double a, double b)
 
double gaussian (void)
 
double gaussian (double mu, double sigma)
 
void ballU (double radius, double *x, double *y)
 
void ballG (double sigma, double *x, double *y)
 

Static Public Member Functions

static bool available (void)
 
- Static Public Member Functions inherited from DUNE::Math::Random::Generator
static int32_t arbitrarySeed (void)
 

Additional Inherited Members

- Static Public Attributes inherited from DUNE::Math::Random::Generator
static const int32_t c_max_random
 

Constructor & Destructor Documentation

DUNE::Math::Random::KernelDevice::KernelDevice ( void  )

Constructor.

DUNE::Math::Random::KernelDevice::~KernelDevice ( void  )

Destructor.

Member Function Documentation

bool DUNE::Math::Random::KernelDevice::available ( void  )
static

Indicates if facility is available.

It will return 'true' is the operating system device file '/dev/urandom' exists.

References DUNE::FileSystem::Path::isDevice().

Referenced by DUNE::Math::Random::Generator::arbitrarySeed().

int32_t DUNE::Math::Random::KernelDevice::random ( void  )
virtual

Generate random integer number, as per the general contract of the base class.

Implements DUNE::Math::Random::Generator.

References DUNE::Math::Random::Generator::c_max_random.

Referenced by DUNE::Math::Random::Generator::arbitrarySeed().

void DUNE::Math::Random::KernelDevice::seed ( int32_t  value)
virtual

Seed method, with no effect for this class.

It is only provided to comply with general contract of base class.

Implements DUNE::Math::Random::Generator.

double DUNE::Math::Random::KernelDevice::uniform ( void  )
virtual

Generate random floating point number, as per the general contract of the base class.

Reimplemented from DUNE::Math::Random::Generator.

Collaboration diagram for DUNE::Math::Random::KernelDevice:
Collaboration graph