A retro style homage to 80s dungeon crawlers hand crafted in C++.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
#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 mean, T stddev) {
|
|
|
|
std::normal_distribution<T> rand(mean, stddev);
|
|
|
|
|
|
|
|
return rand(GENERATOR);
|
|
|
|
}
|
|
|
|
}
|