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.
28 lines
501 B
28 lines
501 B
#pragma once
|
|
#include <random>
|
|
|
|
|
|
namespace Random {
|
|
extern std::mt19937 GENERATOR;
|
|
|
|
template<typename T>
|
|
T uniform(T from, T to) {
|
|
std::uniform_int_distribution<T> rand(from, to);
|
|
|
|
return rand(GENERATOR);
|
|
}
|
|
|
|
template<typename T>
|
|
T uniform_real(T from, T to) {
|
|
std::uniform_real_distribution<T> rand(from, to);
|
|
|
|
return rand(GENERATOR);
|
|
}
|
|
|
|
template<typename T>
|
|
T normal(T from, T to) {
|
|
std::normal_distribution<T> rand(from, to);
|
|
|
|
return rand(GENERATOR);
|
|
}
|
|
}
|
|
|