Just wrote my own entity system to figure it out.
This commit is contained in:
parent
a3eaf78fd3
commit
cc4f83a1d1
8 changed files with 229 additions and 59 deletions
24
rand.hpp
24
rand.hpp
|
@ -1,6 +1,28 @@
|
|||
#pragma once
|
||||
#include <random>
|
||||
|
||||
|
||||
namespace Random {
|
||||
int rand_int(int from, int to);
|
||||
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