blob: 6956edac23542199d7b95c770d214ac8b376b9ef (
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);
}
uint32_t RandomNumberGenerator::in_range(const uint32_t &a,
const uint32_t &b) const noexcept
{
auto random_distribution = std::uniform_int_distribution<uint32_t>(a, b);
return random_distribution(*this->_generator);
}
|