Renamed functions and made static
This commit is contained in:
parent
d0cf4102d6
commit
a6accef426
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
sc::random sc::random::singleton {};
|
sc::random sc::random::singleton {};
|
||||||
|
|
||||||
bool sc::random::random_bool() {
|
bool sc::random::boolean() {
|
||||||
std::uniform_int_distribution<int> dist {0, 1};
|
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};
|
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 {};
|
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};
|
std::uniform_real_distribution<double> dist {from, to};
|
||||||
return dist(_reng);
|
return dist(instance()._reng);
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ namespace sc {
|
|||||||
|
|
||||||
std::default_random_engine& engine() { return _reng; }
|
std::default_random_engine& engine() { return _reng; }
|
||||||
|
|
||||||
bool random_bool();
|
static bool boolean();
|
||||||
int random_int(int from, int to);
|
static int int_between(int from, int to);
|
||||||
double random_double();
|
static double double01();
|
||||||
double random_double(double from, double to);
|
static double double_between(double from, double to);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static T choice(const std::vector<T>& vec) {
|
static T choice(const std::vector<T>& vec) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user