new test cases
worked on all walkers new helper methods new distributions some bugfixes
This commit is contained in:
@@ -4,5 +4,6 @@
|
||||
#include "distribution/Normal.h"
|
||||
#include "distribution/Exponential.h"
|
||||
#include "distribution/Logistic.h"
|
||||
#include "distribution/Uniform.h"
|
||||
|
||||
#endif // DISTRIBUTIONS_H
|
||||
|
||||
38
math/distribution/Uniform.h
Normal file
38
math/distribution/Uniform.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef UNIFORM_H
|
||||
#define UNIFORM_H
|
||||
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
|
||||
namespace Distribution {
|
||||
|
||||
/** uniform distribution */
|
||||
template <typename T> class Uniform {
|
||||
|
||||
private:
|
||||
|
||||
std::minstd_rand gen;
|
||||
std::uniform_real_distribution<T> dist;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
Uniform(const T min, const T max) :
|
||||
gen(1234), dist(min, max) {
|
||||
|
||||
}
|
||||
/** get a uniformaly distributed random number */
|
||||
T draw() {
|
||||
return dist(gen);
|
||||
}
|
||||
|
||||
/** set the seed to use */
|
||||
void setSeed(const long seed) {
|
||||
gen.seed(seed);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // UNIFORM_H
|
||||
Reference in New Issue
Block a user