Public Member Functions | Static Private Member Functions
ecl::RandomNumberGenerator< T > Class Template Reference

A random number generator. More...

#include <random_number_generator.hpp>

List of all members.

Public Member Functions

gaussian (const T &std, const T &mu=0)
 RandomNumberGenerator (const unsigned int randSeed)
 RandomNumberGenerator ()
uniform (const T &range)
uniform ()

Static Private Member Functions

static void seed ()
 Seed the system random number generator.

Detailed Description

template<typename T>
class ecl::RandomNumberGenerator< T >

A random number generator.

Definition at line 41 of file random_number_generator.hpp.


Constructor & Destructor Documentation

template<typename T>
ecl::RandomNumberGenerator< T >::RandomNumberGenerator ( const unsigned int  randSeed) [inline]

Definition at line 44 of file random_number_generator.hpp.

template<typename T>
ecl::RandomNumberGenerator< T >::RandomNumberGenerator ( ) [inline]

Definition at line 49 of file random_number_generator.hpp.


Member Function Documentation

template<typename T>
T ecl::RandomNumberGenerator< T >::gaussian ( const T &  std,
const T &  mu = 0 
) [inline]

Definition at line 64 of file random_number_generator.hpp.

template<typename T>
static void ecl::RandomNumberGenerator< T >::seed ( ) [inline, static, private]

Seed the system random number generator.

Here we create a seed by hashing from three independent sources. This is a more robust way to get a reliable seed that allows you to get the typically para-optimal traits

1) fine grained (e.g. you want to call srand two times in a *very* short interval) 2) low chance of collisions over a long period

It also avoids having to use esoteric linux functions lick clock_gettime that aren't available on all platforms.

References:

-h ttp://stackoverflow.com/questions/322938/recommended-way-to-initialize-srand

Definition at line 111 of file random_number_generator.hpp.

template<typename T>
T ecl::RandomNumberGenerator< T >::uniform ( const T &  range) [inline]

Definition at line 54 of file random_number_generator.hpp.

template<typename T>
T ecl::RandomNumberGenerator< T >::uniform ( ) [inline]

Definition at line 59 of file random_number_generator.hpp.


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


ecl_time
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:29