24 static void Seed(
unsigned int seed) {
25 generator_.seed(seed);
30 std::random_device rd;
31 generator_.seed(rd());
35 static int Range(
int min,
int max) {
36 std::uniform_int_distribution<int> distribution(min, max);
37 return distribution(generator_);
42 std::uniform_real_distribution<float> distribution(0.0f, 1.0f);
43 return distribution(generator_);
47 static float Range(
float min,
float max) {
48 std::uniform_real_distribution<float> distribution(min, max);
49 return distribution(generator_);
75 float z =
Range(-1.0f, 1.0f);
76 float a =
Range(0.0f, 2.0f *
PI);
77 float r = sqrt(1.0f - z * z);
86 AlphaIncluded ?
Value() : 1.0f);
93 AlphaIncluded ?
Range(min, max) : 1.0f);
98 return Range(0, 1) == 1;
103 std::normal_distribution<float> distribution(mean, stddev);
104 return distribution(generator_);
108 inline static std::mt19937 generator_;
A class for generating random numbers and values.
static void Seed(unsigned int seed)
static Sleak::Math::Vector2D Vector2D()
static Sleak::Math::Color Color(float min, float max, bool AlphaIncluded=false)
static Sleak::Math::Vector3D Vector3D(float min, float max)
static void SeedWithTime()
static float Range(float min, float max)
static Sleak::Math::Vector3D Vector3D()
static Sleak::Math::Color Color(bool AlphaIncluded=false)
static Sleak::Math::Vector3D UnitVector()
static Sleak::Math::Vector2D Vector2D(float min, float max)
static float NormalDistribution(float mean, float stddev)
static int Range(int min, int max)
Vectors, matrices, quaternions, colors, AABBs, and random helpers.
Root namespace for everything the engine exposes.