21 lines
527 B
C++
21 lines
527 B
C++
|
#include <VUtils/Random.h>
|
||
|
|
||
|
namespace VUtils {
|
||
|
Random::Random() : m_mt{ m_rd() } {
|
||
|
}
|
||
|
|
||
|
double Random::generate(double min, double max) {
|
||
|
return Random::the().get(min, max);
|
||
|
}
|
||
|
|
||
|
double Random::get(double min, double max) {
|
||
|
std::uniform_real_distribution<double> dist(min, max);
|
||
|
return dist(m_mt);
|
||
|
}
|
||
|
void Random::setDist(double min, double max) {
|
||
|
m_dist = std::uniform_real_distribution(min, max);
|
||
|
}
|
||
|
double Random::getFast() {
|
||
|
return m_dist(m_mt);
|
||
|
}
|
||
|
}
|