diff options
Diffstat (limited to 'src/randomization')
-rw-r--r-- | src/randomization/generator.cpp | 14 | ||||
-rw-r--r-- | src/randomization/generator.hpp | 18 | ||||
-rw-r--r-- | src/randomization/seed_generator.cpp | 6 | ||||
-rw-r--r-- | src/randomization/seed_generator.hpp | 19 |
4 files changed, 0 insertions, 57 deletions
diff --git a/src/randomization/generator.cpp b/src/randomization/generator.cpp deleted file mode 100644 index 49adb97..0000000 --- a/src/randomization/generator.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "generator.hpp" - -RandomNumberGenerator::RandomNumberGenerator(const uint32_t &seed) noexcept -{ - this->_generator = std::make_unique<std::mt19937>(seed); -} - -auto RandomNumberGenerator::in_range(const uint32_t &a, const uint32_t &b) const noexcept - -> uint32_t -{ - 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 deleted file mode 100644 index 24b9bd6..0000000 --- a/src/randomization/generator.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "interfaces/randomization.hpp" - -#include <memory> -#include <random> - -class RandomNumberGenerator : public IRandomNumberGenerator -{ -public: - explicit RandomNumberGenerator(const uint32_t &seed) noexcept; - - [[nodiscard]] auto in_range(const uint32_t &a, const uint32_t &b) const noexcept - -> uint32_t override; - -private: - std::unique_ptr<std::mt19937> _generator; -}; diff --git a/src/randomization/seed_generator.cpp b/src/randomization/seed_generator.cpp deleted file mode 100644 index a0f9303..0000000 --- a/src/randomization/seed_generator.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "seed_generator.hpp" - -auto SeedGenerator::random_seed() noexcept -> uint32_t -{ - return _random_device(); -} diff --git a/src/randomization/seed_generator.hpp b/src/randomization/seed_generator.hpp deleted file mode 100644 index 3584966..0000000 --- a/src/randomization/seed_generator.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "interfaces/randomization.hpp" - -#include <yacppdic/auto_wirable.hpp> - -#include <random> - -class SeedGenerator : public ISeedGenerator, - public yacppdic::AutoWirable<ISeedGenerator, SeedGenerator> -{ -public: - SeedGenerator() noexcept = default; - - [[nodiscard]] auto random_seed() noexcept -> uint32_t override; - -private: - std::random_device _random_device; -}; |