You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
479 B
26 lines
479 B
2 years ago
|
#pragma once
|
||
|
|
||
|
#include <random>
|
||
|
|
||
|
static std::default_random_engine rng;
|
||
|
|
||
|
namespace perses::util
|
||
|
{
|
||
|
template<typename _Ty>
|
||
|
_Ty genRandInteger()
|
||
|
{
|
||
|
std::random_device r;
|
||
|
std::default_random_engine e1(r());
|
||
|
std::uniform_int_distribution<_Ty> dist;
|
||
|
return dist(e1);
|
||
|
}
|
||
|
|
||
|
template<typename _Ty>
|
||
|
_Ty genRandInteger(_Ty min, _Ty max)
|
||
|
{
|
||
|
std::random_device r;
|
||
|
std::default_random_engine e1(r());
|
||
|
std::uniform_int_distribution<_Ty> dist(min, max);
|
||
|
return dist(e1);
|
||
|
}
|
||
|
}
|