From 8bcbd2729388edc63c82d77d314b583af1447c49 Mon Sep 17 00:00:00 2001 From: untodesu Date: Sun, 14 Sep 2025 19:16:44 +0500 Subject: Cleanup math with qfengine ports again --- core/math/randomizer.hh | 56 ------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 core/math/randomizer.hh (limited to 'core/math/randomizer.hh') diff --git a/core/math/randomizer.hh b/core/math/randomizer.hh deleted file mode 100644 index db21c95..0000000 --- a/core/math/randomizer.hh +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -namespace math -{ -template -class Randomizer final { -public: - explicit Randomizer(void); - explicit Randomizer(std::uint64_t seed); - virtual ~Randomizer(void) = default; - void add(const T& value); - const T& get(void); - void clear(void); - -private: - std::vector m_vector; - std::mt19937_64 m_twister; - std::uniform_int_distribution m_dist; -}; -} // namespace math - -template -inline math::Randomizer::Randomizer(void) -{ - m_vector.clear(); - m_twister.seed(std::random_device()()); - m_dist = std::uniform_int_distribution(0, 0); -} - -template -inline math::Randomizer::Randomizer(std::uint64_t seed) -{ - m_vector.clear(); - m_twister.seed(seed); - m_dist = std::uniform_int_distribution(0, 0); -} - -template -inline void math::Randomizer::add(const T& value) -{ - m_vector.push_back(value); - m_dist = std::uniform_int_distribution(0, m_vector.size() - 1); -} - -template -inline const T& math::Randomizer::get(void) -{ - return m_vector.at(m_dist(m_twister)); -} - -template -inline void math::Randomizer::clear(void) -{ - m_vector.clear(); - m_dist = std::uniform_int_distribution(0, 0); -} -- cgit