IRandom.h
Go to the documentation of this file.
1 #ifndef WIRECELL_IRANDOM
2 #define WIRECELL_IRANDOM
3 
5 #include <functional>
6 
7 namespace WireCell {
8 
9  class IRandom : public IComponent<IRandom> {
10  public:
11  virtual ~IRandom() ;
12 
13  /// Sample a binomial distribution
14  virtual int binomial(int max, double prob) = 0;
15 
16  /// Sample a Poisson distribution.
17  virtual int poisson(double mean) = 0;
18 
19  /// Sample a normal distribution.
20  virtual double normal(double mean, double sigma) = 0;
21 
22  /// Sample a uniform distribution
23  virtual double uniform(double begin, double end) = 0;
24 
25  /// Sample an exponential distribution
26  virtual double exponential(double mean) = 0;
27 
28  /// Sample a uniform integer range.
29  virtual int range(int first, int last) = 0;
30 
31  };
32 
33 }
34 
35 #endif
virtual double normal(double mean, double sigma)=0
Sample a normal distribution.
virtual double exponential(double mean)=0
Sample an exponential distribution.
virtual int poisson(double mean)=0
Sample a Poisson distribution.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:72
virtual double uniform(double begin, double end)=0
Sample a uniform distribution.
static int max(int a, int b)
Definition: Main.h:22
virtual int binomial(int max, double prob)=0
Sample a binomial distribution.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:67
virtual int range(int first, int last)=0
Sample a uniform integer range.
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:15