diff --git a/source/fuzz/pseudo_random_generator.cpp b/source/fuzz/pseudo_random_generator.cpp index 9643264a2..51f0538bf 100644 --- a/source/fuzz/pseudo_random_generator.cpp +++ b/source/fuzz/pseudo_random_generator.cpp @@ -25,8 +25,12 @@ PseudoRandomGenerator::~PseudoRandomGenerator() = default; uint32_t PseudoRandomGenerator::RandomUint32(uint32_t bound) { assert(bound > 0 && "Bound must be positive"); - return static_cast( - std::uniform_int_distribution<>(0, bound - 1)(mt_)); + return std::uniform_int_distribution(0, bound - 1)(mt_); +} + +uint64_t PseudoRandomGenerator::RandomUint64(uint64_t bound) { + assert(bound > 0 && "Bound must be positive"); + return std::uniform_int_distribution(0, bound - 1)(mt_); } bool PseudoRandomGenerator::RandomBool() { diff --git a/source/fuzz/pseudo_random_generator.h b/source/fuzz/pseudo_random_generator.h index d2f529205..7c19833fd 100644 --- a/source/fuzz/pseudo_random_generator.h +++ b/source/fuzz/pseudo_random_generator.h @@ -31,6 +31,8 @@ class PseudoRandomGenerator : public RandomGenerator { uint32_t RandomUint32(uint32_t bound) override; + uint64_t RandomUint64(uint64_t bound) override; + uint32_t RandomPercentage() override; bool RandomBool() override; diff --git a/source/fuzz/random_generator.h b/source/fuzz/random_generator.h index 9c467983d..8c1baaab2 100644 --- a/source/fuzz/random_generator.h +++ b/source/fuzz/random_generator.h @@ -29,6 +29,9 @@ class RandomGenerator { // Returns a value in the half-open interval [0, bound). virtual uint32_t RandomUint32(uint32_t bound) = 0; + // Returns a value in the half-open interval [0, bound). + virtual uint64_t RandomUint64(uint64_t bound) = 0; + // Returns a value in the closed interval [0, 100]. virtual uint32_t RandomPercentage() = 0;