aboutsummaryrefslogtreecommitdiff
path: root/src/randomization/generator.cpp
blob: 49adb97ac4e4dbf8271815246dfc7a755f0b413e (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);
}