Skip to content
Snippets Groups Projects
AbstractRandom.cpp 621 B
Newer Older
  • Learn to ignore specific revisions
  • Radim Vavřík's avatar
    Radim Vavřík committed
    #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
    
    	}
    }