14 std::uniform_int_distribution<int> distrib(a_min, a_max);
24 std::uniform_real_distribution<float> distrib(a_min, a_max);
36 const double factor = std::pow(10.0,
static_cast<double>(decimals));
37 return static_cast<float>(std::round(value * factor) / factor);
46 std::uniform_real_distribution<double> distrib(a_min, a_max);
54 std::bernoulli_distribution distrib(0.5);
64 std::bernoulli_distribution distrib(p);
74 const auto chance = std::clamp(a_chancePercent, 0.0f, 100.0f);
86 static std::mt19937 gen(std::random_device{}());
static int GetRandomInt(const int a_min, const int a_max)
Get random integer between 2 values.
Definition st-random.h:12
static std::mt19937 & GetRNG()
Definition st-random.h:84
static double GetRandomDouble(const double a_min, const double a_max)
Get random double between 2 values.
Definition st-random.h:44
static bool GetWeightedRandomBool(const float p=0.5)
Get weighted random bool.
Definition st-random.h:62
static bool IsPercentageChanceFloat(const float a_chancePercent)
Rolls a random chance check against a given percentage.
Definition st-random.h:72
static float GetRandomRoundedFloat(const float a_min, const float a_max, const int decimals=2)
Get random float rounded to a set amount of decimals.
Definition st-random.h:33
static float GetRandomFloat(const float a_min, const float a_max)
Get random float between 2 values.
Definition st-random.h:22
static bool GetRandomBool()
Get random bool.
Definition st-random.h:52