aboutsummaryrefslogtreecommitdiff
path: root/src/random_generator.cpp
blob: 1f17a883c170eade48baaeb74b45f3b5a96bd6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "random_generator.hpp"

RandomNumberGenerator::RandomNumberGenerator(unsigned int seed)
{
	this->_generator = std::make_unique<std::mt19937>(seed);
}

RandomNumberGenerator::RandomNumberGenerator()
{
	std::random_device random_device;

	this->_generator = std::make_unique<std::mt19937>(random_device());
}

unsigned int RandomNumberGenerator::in_range(unsigned int a, unsigned int b)
{
	auto random_distribution = std::uniform_int_distribution<unsigned int>(a, b);

	return random_distribution(*this->_generator);
}