From 6cd00aacfa22fed6a54a9b812f6b069ad16feec0 Mon Sep 17 00:00:00 2001 From: untodesu Date: Sun, 29 Jun 2025 22:24:42 +0500 Subject: Move game sources into src subdirectory --- core/randomizer.hh | 57 ------------------------------------------------------ 1 file changed, 57 deletions(-) delete mode 100644 core/randomizer.hh (limited to 'core/randomizer.hh') diff --git a/core/randomizer.hh b/core/randomizer.hh deleted file mode 100644 index b60b839..0000000 --- a/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