This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/math/distribution/Uniform.h
FrankE 2e2c1a3004 new test cases
worked on all walkers
new helper methods
new distributions
some bugfixes
2016-02-02 21:43:15 +01:00

39 lines
550 B
C++

#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