summaryrefslogtreecommitdiffstats
path: root/core/math/randomizer.hh
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-14 19:16:44 +0500
committeruntodesu <kirill@untode.su>2025-09-14 19:16:44 +0500
commit8bcbd2729388edc63c82d77d314b583af1447c49 (patch)
tree460c2b509372077f6adf95d72c4245988a580aed /core/math/randomizer.hh
parent7fc7fdb001bea8674fe0dbc1b962f3ec2702debb (diff)
downloadvoxelius-8bcbd2729388edc63c82d77d314b583af1447c49.tar.bz2
voxelius-8bcbd2729388edc63c82d77d314b583af1447c49.zip
Cleanup math with qfengine ports again
Diffstat (limited to 'core/math/randomizer.hh')
-rw-r--r--core/math/randomizer.hh56
1 files changed, 0 insertions, 56 deletions
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<typename T>
-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<T> m_vector;
- std::mt19937_64 m_twister;
- std::uniform_int_distribution<std::size_t> m_dist;
-};
-} // namespace math
-
-template<typename T>
-inline math::Randomizer<T>::Randomizer(void)
-{
- m_vector.clear();
- m_twister.seed(std::random_device()());
- m_dist = std::uniform_int_distribution<std::size_t>(0, 0);
-}
-
-template<typename T>
-inline math::Randomizer<T>::Randomizer(std::uint64_t seed)
-{
- m_vector.clear();
- m_twister.seed(seed);
- m_dist = std::uniform_int_distribution<std::size_t>(0, 0);
-}
-
-template<typename T>
-inline void math::Randomizer<T>::add(const T& value)
-{
- m_vector.push_back(value);
- m_dist = std::uniform_int_distribution<std::size_t>(0, m_vector.size() - 1);
-}
-
-template<typename T>
-inline const T& math::Randomizer<T>::get(void)
-{
- return m_vector.at(m_dist(m_twister));
-}
-
-template<typename T>
-inline void math::Randomizer<T>::clear(void)
-{
- m_vector.clear();
- m_dist = std::uniform_int_distribution<std::size_t>(0, 0);
-}