|
@ -4,17 +4,12 @@ |
|
|
|
|
|
|
|
|
namespace storm { |
|
|
namespace storm { |
|
|
namespace utility { |
|
|
namespace utility { |
|
|
RandomProbabilityGenerator<double>::RandomProbabilityGenerator() |
|
|
|
|
|
: distribution(0.0, 1.0) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<double>::RandomProbabilityGenerator() : distribution(0.0, 1.0) { |
|
|
std::random_device rd; |
|
|
std::random_device rd; |
|
|
engine = std::mt19937(rd()); |
|
|
engine = std::mt19937(rd()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<double>::RandomProbabilityGenerator(uint64_t seed) |
|
|
|
|
|
: distribution(0.0, 1.0), engine(seed) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<double>::RandomProbabilityGenerator(uint64_t seed) : distribution(0.0, 1.0), engine(seed) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
double RandomProbabilityGenerator<double>::random() { |
|
|
double RandomProbabilityGenerator<double>::random() { |
|
@ -25,22 +20,16 @@ namespace storm { |
|
|
return std::uniform_int_distribution<uint64_t>(min, max)(engine); |
|
|
return std::uniform_int_distribution<uint64_t>(min, max)(engine); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator() |
|
|
|
|
|
: distribution(0, std::numeric_limits<uint64_t>::max()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator() : distribution(0, std::numeric_limits<uint64_t>::max()) { |
|
|
std::random_device rd; |
|
|
std::random_device rd; |
|
|
engine = std::mt19937(rd()); |
|
|
engine = std::mt19937(rd()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator(uint64_t seed) |
|
|
|
|
|
: distribution(0, std::numeric_limits<uint64_t>::max()), engine(seed) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator(uint64_t seed) : distribution(0, std::numeric_limits<uint64_t>::max()), engine(seed) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
RationalNumber RandomProbabilityGenerator<RationalNumber>::random() { |
|
|
RationalNumber RandomProbabilityGenerator<RationalNumber>::random() { |
|
|
return carl::rationalize<RationalNumber>(distribution(engine)) / carl::rationalize<RationalNumber>(std::numeric_limits<uint64_t>::max()); |
|
|
return carl::rationalize<RationalNumber>(distribution(engine)) / carl::rationalize<RationalNumber>(std::numeric_limits<uint64_t>::max()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint64_t RandomProbabilityGenerator<RationalNumber>::random_uint(uint64_t min, uint64_t max) { |
|
|
uint64_t RandomProbabilityGenerator<RationalNumber>::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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |