diff options
Diffstat (limited to 'src/randomization')
-rw-r--r-- | src/randomization/generator.cpp | 7 | ||||
-rw-r--r-- | src/randomization/generator.hpp | 5 | ||||
-rw-r--r-- | src/randomization/seed_generator.cpp | 2 | ||||
-rw-r--r-- | src/randomization/seed_generator.hpp | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/src/randomization/generator.cpp b/src/randomization/generator.cpp index b9bcb8a..56fbbf1 100644 --- a/src/randomization/generator.cpp +++ b/src/randomization/generator.cpp @@ -1,14 +1,13 @@ #include "generator.hpp" -RandomNumberGenerator::RandomNumberGenerator(const unsigned int &seed) +RandomNumberGenerator::RandomNumberGenerator(const uint32_t &seed) { this->_generator = std::make_unique<std::mt19937>(seed); } -unsigned int RandomNumberGenerator::in_range(const unsigned int &a, - const unsigned int &b) const +uint32_t RandomNumberGenerator::in_range(const uint32_t &a, const uint32_t &b) const { - auto random_distribution = std::uniform_int_distribution<unsigned int>(a, b); + auto random_distribution = std::uniform_int_distribution<uint32_t>(a, b); return random_distribution(*this->_generator); } diff --git a/src/randomization/generator.hpp b/src/randomization/generator.hpp index 3acfc98..35bd9eb 100644 --- a/src/randomization/generator.hpp +++ b/src/randomization/generator.hpp @@ -8,10 +8,9 @@ class RandomNumberGenerator : public IRandomNumberGenerator { public: - explicit RandomNumberGenerator(const unsigned int &seed); + explicit RandomNumberGenerator(const uint32_t &seed); - [[nodiscard]] unsigned int in_range(const unsigned int &a, - const unsigned int &b) const override; + [[nodiscard]] uint32_t in_range(const uint32_t &a, const uint32_t &b) const override; private: std::unique_ptr<std::mt19937> _generator; diff --git a/src/randomization/seed_generator.cpp b/src/randomization/seed_generator.cpp index fdb2b12..5d51e18 100644 --- a/src/randomization/seed_generator.cpp +++ b/src/randomization/seed_generator.cpp @@ -5,7 +5,7 @@ SeedGenerator::SeedGenerator(const std::shared_ptr<std::random_device> &random_d { } -unsigned int SeedGenerator::random_seed() const +uint32_t SeedGenerator::random_seed() const { return (*_random_device)(); } diff --git a/src/randomization/seed_generator.hpp b/src/randomization/seed_generator.hpp index 238fdbe..1447a8c 100644 --- a/src/randomization/seed_generator.hpp +++ b/src/randomization/seed_generator.hpp @@ -10,7 +10,7 @@ class SeedGenerator : public ISeedGenerator public: explicit SeedGenerator(const std::shared_ptr<std::random_device> &random_device); - [[nodiscard]] unsigned int random_seed() const override; + [[nodiscard]] uint32_t random_seed() const override; private: const std::shared_ptr<std::random_device> &_random_device; |