Public Member Functions | Private Attributes | List of all members
RandomT< URNG > Class Template Reference
Inheritance diagram for RandomT< URNG >:

Public Member Functions

 RandomT (std::vector< unsigned int > seeds)
 
virtual int binomial (int max, double prob)
 
virtual int poisson (double mean)
 
virtual double normal (double mean, double sigma)
 
virtual double uniform (double begin, double end)
 
virtual double exponential (double mean)
 
virtual int range (int first, int last)
 

Private Attributes

URNG m_rng
 

Detailed Description

template<typename URNG>
class RandomT< URNG >

Definition at line 36 of file Random.cxx.

Constructor & Destructor Documentation

template<typename URNG >
RandomT< URNG >::RandomT ( std::vector< unsigned int >  seeds)
inline

Definition at line 39 of file Random.cxx.

39  {
40  std::seed_seq seed(seeds.begin(), seeds.end());
41  m_rng.seed(seed);
42  }
URNG m_rng
Definition: Random.cxx:37

Member Function Documentation

template<typename URNG >
virtual int RandomT< URNG >::binomial ( int  max,
double  prob 
)
inlinevirtual

Definition at line 44 of file Random.cxx.

44  {
45  std::binomial_distribution<int> distribution(max, prob);
46  return distribution(m_rng);
47  }
static int max(int a, int b)
URNG m_rng
Definition: Random.cxx:37
template<typename URNG >
virtual double RandomT< URNG >::exponential ( double  mean)
inlinevirtual

Definition at line 61 of file Random.cxx.

61  {
62  std::exponential_distribution<double> distribution(mean);
63  return distribution(m_rng);
64  }
URNG m_rng
Definition: Random.cxx:37
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:15
template<typename URNG >
virtual double RandomT< URNG >::normal ( double  mean,
double  sigma 
)
inlinevirtual

Definition at line 52 of file Random.cxx.

52  {
53  std::normal_distribution<double> distribution(mean, sigma);
54  return distribution(m_rng);
55 
56  }
URNG m_rng
Definition: Random.cxx:37
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:15
template<typename URNG >
virtual int RandomT< URNG >::poisson ( double  mean)
inlinevirtual

Definition at line 48 of file Random.cxx.

48  {
49  std::poisson_distribution<int> distribution(mean);
50  return distribution(m_rng);
51  }
URNG m_rng
Definition: Random.cxx:37
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:15
template<typename URNG >
virtual int RandomT< URNG >::range ( int  first,
int  last 
)
inlinevirtual

Definition at line 65 of file Random.cxx.

65  {
66  std::uniform_int_distribution<int> distribution(first, last);
67  return distribution(m_rng);
68  }
URNG m_rng
Definition: Random.cxx:37
template<typename URNG >
virtual double RandomT< URNG >::uniform ( double  begin,
double  end 
)
inlinevirtual

Definition at line 57 of file Random.cxx.

57  {
58  std::uniform_real_distribution<double> distribution(begin, end);
59  return distribution(m_rng);
60  }
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:72
URNG m_rng
Definition: Random.cxx:37
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:67

Member Data Documentation

template<typename URNG >
URNG RandomT< URNG >::m_rng
private

Definition at line 37 of file Random.cxx.


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