24 lines
569 B
C++
24 lines
569 B
C++
|
#include "random.hpp"
|
||
|
|
||
|
sc::random sc::random::singleton {};
|
||
|
|
||
|
bool sc::random::random_bool() {
|
||
|
std::uniform_int_distribution<int> dist {0, 1};
|
||
|
return dist(_reng) == 1;
|
||
|
}
|
||
|
|
||
|
int sc::random::random_int(int from, int to) {
|
||
|
std::uniform_int_distribution<int> dist {from, to};
|
||
|
return dist(_reng);
|
||
|
}
|
||
|
|
||
|
double sc::random::random_double() {
|
||
|
std::uniform_real_distribution<double> dist {};
|
||
|
return dist(_reng);
|
||
|
}
|
||
|
|
||
|
double sc::random::random_double(double from, double to) {
|
||
|
std::uniform_real_distribution<double> dist {from, to};
|
||
|
return dist(_reng);
|
||
|
}
|