diff --git a/src/storm/utility/random.cpp b/src/storm/utility/random.cpp index 9e2d0ae35..8c576cf95 100644 --- a/src/storm/utility/random.cpp +++ b/src/storm/utility/random.cpp @@ -4,17 +4,12 @@ namespace storm { namespace utility { - RandomProbabilityGenerator::RandomProbabilityGenerator() - : distribution(0.0, 1.0) - { + RandomProbabilityGenerator::RandomProbabilityGenerator() : distribution(0.0, 1.0) { std::random_device rd; engine = std::mt19937(rd()); } - RandomProbabilityGenerator::RandomProbabilityGenerator(uint64_t seed) - : distribution(0.0, 1.0), engine(seed) - { - + RandomProbabilityGenerator::RandomProbabilityGenerator(uint64_t seed) : distribution(0.0, 1.0), engine(seed) { } double RandomProbabilityGenerator::random() { @@ -25,22 +20,16 @@ namespace storm { return std::uniform_int_distribution(min, max)(engine); } - RandomProbabilityGenerator::RandomProbabilityGenerator() - : distribution(0, std::numeric_limits::max()) - { + RandomProbabilityGenerator::RandomProbabilityGenerator() : distribution(0, std::numeric_limits::max()) { std::random_device rd; engine = std::mt19937(rd()); } - RandomProbabilityGenerator::RandomProbabilityGenerator(uint64_t seed) - : distribution(0, std::numeric_limits::max()), engine(seed) - { - + RandomProbabilityGenerator::RandomProbabilityGenerator(uint64_t seed) : distribution(0, std::numeric_limits::max()), engine(seed) { } RationalNumber RandomProbabilityGenerator::random() { return carl::rationalize(distribution(engine)) / carl::rationalize(std::numeric_limits::max()); - } uint64_t RandomProbabilityGenerator::random_uint(uint64_t min, uint64_t max) { @@ -48,5 +37,11 @@ namespace storm { } + ExponentialDistributionGenerator::ExponentialDistributionGenerator(double rate) : distribution(rate) { + } + + double ExponentialDistributionGenerator::random(boost::mt19937& engine) { + return distribution(engine); + } } } diff --git a/src/storm/utility/random.h b/src/storm/utility/random.h index 7e6e015be..80a8d5e61 100644 --- a/src/storm/utility/random.h +++ b/src/storm/utility/random.h @@ -1,4 +1,5 @@ #include +#include #include "storm/adapters/RationalNumberAdapter.h" namespace storm { @@ -41,6 +42,13 @@ namespace storm { }; + class ExponentialDistributionGenerator { + public: + ExponentialDistributionGenerator(double rate); + double random(boost::mt19937& engine); + private: + boost::random::exponential_distribution<> distribution; + }; } } \ No newline at end of file