Renamed functions and made static

This commit is contained in:
Bob Polis 2021-10-06 11:28:24 +02:00
parent d0cf4102d6
commit a6accef426
2 changed files with 12 additions and 12 deletions

View File

@ -2,22 +2,22 @@
sc::random sc::random::singleton {};
bool sc::random::random_bool() {
bool sc::random::boolean() {
std::uniform_int_distribution<int> dist {0, 1};
return dist(_reng) == 1;
return dist(instance()._reng) == 1;
}
int sc::random::random_int(int from, int to) {
int sc::random::int_between(int from, int to) {
std::uniform_int_distribution<int> dist {from, to};
return dist(_reng);
return dist(instance()._reng);
}
double sc::random::random_double() {
double sc::random::double01() {
std::uniform_real_distribution<double> dist {};
return dist(_reng);
return dist(instance()._reng);
}
double sc::random::random_double(double from, double to) {
double sc::random::double_between(double from, double to) {
std::uniform_real_distribution<double> dist {from, to};
return dist(_reng);
return dist(instance()._reng);
}

View File

@ -20,10 +20,10 @@ namespace sc {
std::default_random_engine& engine() { return _reng; }
bool random_bool();
int random_int(int from, int to);
double random_double();
double random_double(double from, double to);
static bool boolean();
static int int_between(int from, int to);
static double double01();
static double double_between(double from, double to);
template <typename T>
static T choice(const std::vector<T>& vec) {