From 458e0005690ea9d579588a0a12368fc2c2c9a93a Mon Sep 17 00:00:00 2001 From: untodesu Date: Tue, 1 Jul 2025 03:08:39 +0500 Subject: I hyper-focued on refactoring again - I put a cool-sounding "we are number one" remix on repeat and straight up grinded the entire repository to a better state until 03:09 AM. I guess I have something wrong in my brain that makes me do this shit --- src/core/randomizer.hh | 57 -------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 src/core/randomizer.hh (limited to 'src/core/randomizer.hh') diff --git a/src/core/randomizer.hh b/src/core/randomizer.hh deleted file mode 100644 index 4d1bb83..0000000 --- a/src/core/randomizer.hh +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef CORE_RANDOMIZER_HH -#define CORE_RANDOMIZER_HH 1 -#pragma once - -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; -}; - -template -inline Randomizer::Randomizer(void) -{ - m_vector.clear(); - m_twister.seed(std::random_device()()); - m_dist = std::uniform_int_distribution(0, 0); -} - -template -inline Randomizer::Randomizer(std::uint64_t seed) -{ - m_vector.clear(); - m_twister.seed(seed); - m_dist = std::uniform_int_distribution(0, 0); -} - -template -inline void 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& Randomizer::get(void) -{ - return m_vector.at(m_dist(m_twister)); -} - -template -inline void Randomizer::clear(void) -{ - m_vector.clear(); - m_dist = std::uniform_int_distribution(0, 0); -} - -#endif // CORE_RANDOMIZER_HH -- cgit