blob: 2febf166013aa499753861935aab3b20eec37f42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "generator.hpp"
RandomNumberGenerator::RandomNumberGenerator(const uint32_t &seed) noexcept
{
this->_generator = std::make_unique<std::mt19937>(seed);
}
auto RandomNumberGenerator::in_range(const uint32_t &a,
const uint32_t &b) const noexcept -> uint32_t
{
auto random_distribution = std::uniform_int_distribution<uint32_t>(a, b);
return random_distribution(*this->_generator);
}
|