mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
feat: add cave (#8)
* feat: add cave generate * fix: incorrect blocks on cave surface * fix: non-deterministic cave generator * refactor: move all chunk generation to dedicated generation thread * refactor: remove inital cave * feat: add cave parameter adjustment * refactor: adjust cave probability
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
#include "Cubed/tools/cubed_random.hpp"
|
||||
|
||||
#include "Cubed/tools/log.hpp"
|
||||
|
||||
namespace Cubed {
|
||||
|
||||
Random::Random() {}
|
||||
|
||||
Random::Random(unsigned seed) { init(seed); }
|
||||
bool Random::random_bool(double probability) {
|
||||
std::bernoulli_distribution dist(probability);
|
||||
return dist(m_engine);
|
||||
@@ -19,5 +17,13 @@ void Random::init(unsigned seed) {
|
||||
m_seed = seed;
|
||||
m_engine.seed(seed);
|
||||
}
|
||||
int Random::random_int(int min, int max) {
|
||||
std::uniform_int_distribution<int> dist(min, max);
|
||||
return dist(m_engine);
|
||||
}
|
||||
float Random::random_float(float min, float max) {
|
||||
std::uniform_real_distribution<float> dist(min, max);
|
||||
return dist(m_engine);
|
||||
}
|
||||
|
||||
} // namespace Cubed
|
||||
Reference in New Issue
Block a user