aboutsummaryrefslogtreecommitdiff
path: root/src/randomization
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-04-04 11:04:41 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:58 +0200
commita93270968f9aab5d8c1c528daf02c8b27d09eed7 (patch)
tree471394acdf19139a606ca68e558f84dc45ab5171 /src/randomization
parent9e61e23ad2ac72030f14ea59e502c19d52995f3a (diff)
refactor: fix compiler errors with libc++
Diffstat (limited to 'src/randomization')
-rw-r--r--src/randomization/seed_generator.cpp10
-rw-r--r--src/randomization/seed_generator.hpp12
2 files changed, 8 insertions, 14 deletions
diff --git a/src/randomization/seed_generator.cpp b/src/randomization/seed_generator.cpp
index 5aedf17..a0f9303 100644
--- a/src/randomization/seed_generator.cpp
+++ b/src/randomization/seed_generator.cpp
@@ -1,12 +1,6 @@
#include "seed_generator.hpp"
-SeedGenerator::SeedGenerator(
- const std::shared_ptr<std::random_device> &random_device) noexcept
- : _random_device(random_device)
+auto SeedGenerator::random_seed() noexcept -> uint32_t
{
-}
-
-auto SeedGenerator::random_seed() const noexcept -> uint32_t
-{
- return (*_random_device)();
+ return _random_device();
}
diff --git a/src/randomization/seed_generator.hpp b/src/randomization/seed_generator.hpp
index 2439949..71fd089 100644
--- a/src/randomization/seed_generator.hpp
+++ b/src/randomization/seed_generator.hpp
@@ -1,18 +1,18 @@
#pragma once
+#include "DI/auto_wirable.hpp"
#include "interfaces/randomization.hpp"
-#include <memory>
#include <random>
-class SeedGenerator : public ISeedGenerator
+class SeedGenerator : public ISeedGenerator,
+ public AutoWirable<ISeedGenerator, SeedGenerator>
{
public:
- explicit SeedGenerator(
- const std::shared_ptr<std::random_device> &random_device) noexcept;
+ SeedGenerator() noexcept = default;
- [[nodiscard]] auto random_seed() const noexcept -> uint32_t override;
+ [[nodiscard]] auto random_seed() noexcept -> uint32_t override;
private:
- const std::shared_ptr<std::random_device> &_random_device;
+ std::random_device _random_device;
};