feat: add tree generation

This commit is contained in:
2026-04-18 10:59:37 +08:00
parent 63930dcdc7
commit bb888fd7b7
27 changed files with 224 additions and 30 deletions

View File

@@ -0,0 +1,34 @@
#include <Cubed/tools/cubed_random.hpp>
#include <Cubed/tools/log.hpp>
namespace Cubed {
Random::Random() {
std::random_device d;
m_seed = d();
Logger::info("Seed: {}", m_seed);
m_engine.seed(m_seed);
}
Random& Random::get() {
static Random instance;
return instance;
}
bool Random::random_bool(double probability) {
std::bernoulli_distribution dist(probability);
return dist(m_engine);
}
std::mt19937& Random::engine() {
return m_engine;
}
unsigned Random::seed() {
return m_seed;
}
}