Just wrote my own entity system to figure it out.

This commit is contained in:
Zed A. Shaw 2024-10-10 17:34:33 -04:00
parent a3eaf78fd3
commit cc4f83a1d1
8 changed files with 229 additions and 59 deletions

View file

@ -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);
}
}