Brought over a bunch of code from the roguelike and now will use it to generate a random map.
This commit is contained in:
parent
8d3d3b4ec3
commit
2daa1c9bd5
59 changed files with 4303 additions and 411 deletions
28
rand.hpp
Normal file
28
rand.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue