Newer
Older
#include "AbstractRandom.h"
#include <chrono>
namespace math1d_cl {
AbstractRandom::AbstractRandom(UncertainityOptions options) : m_options(options)
{
}
double AbstractRandom::getRandDouble(double min, double max)
{
std::uniform_real_distribution<double> distribution(min,max);
//std::normal_distribution<double> distribution(min,max);
return distribution(m_rand);
}
void AbstractRandom::seed()
{
// Seed random engine with time seed
#ifdef DEBUG
m_rand.seed(1); // Debug seed
#else
m_rand.seed(std::chrono::system_clock::now().time_since_epoch().count()); // Standard seed
#endif
}
}