|
|
@ -1,5 +1,7 @@ |
|
|
|
#include "storm/utility/random.h"
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
namespace storm { |
|
|
|
namespace utility { |
|
|
|
RandomProbabilityGenerator<double>::RandomProbabilityGenerator() |
|
|
@ -23,6 +25,28 @@ namespace storm { |
|
|
|
return std::uniform_int_distribution<uint64_t>(min, max)(engine); |
|
|
|
} |
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator() |
|
|
|
: distribution(0, std::numeric_limits<uint64_t>::max()) |
|
|
|
{ |
|
|
|
std::random_device rd; |
|
|
|
engine = std::mt19937(rd()); |
|
|
|
} |
|
|
|
|
|
|
|
RandomProbabilityGenerator<RationalNumber>::RandomProbabilityGenerator(uint64_t seed) |
|
|
|
: distribution(0, std::numeric_limits<uint64_t>::max()), engine(seed) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
RationalNumber RandomProbabilityGenerator<RationalNumber>::random() { |
|
|
|
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) { |
|
|
|
return std::uniform_int_distribution<uint64_t>(min, max)(engine); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |