refactored random subsystem

added compile-time seed support
This commit is contained in:
2016-04-26 15:15:28 +02:00
parent 8f6bfa917f
commit 62d8d6b36b
17 changed files with 163 additions and 29 deletions

View File

@@ -3,6 +3,7 @@
#include <cmath>
#include <random>
#include "../Random.h"
namespace Distribution {
@@ -15,14 +16,14 @@ namespace Distribution {
const T sigma;
const T _a;
std::minstd_rand gen;
RandomGenerator gen;
std::normal_distribution<T> dist;
public:
/** ctor */
Normal(const T mu, const T sigma) :
mu(mu), sigma(sigma), _a(1.0 / (sigma * std::sqrt(2.0 * M_PI))), gen(1234), dist(mu,sigma) {
mu(mu), sigma(sigma), _a(1.0 / (sigma * std::sqrt(2.0 * M_PI))), gen(RANDOM_SEED), dist(mu,sigma) {
}