diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-13 07:29:09 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-13 07:29:09 -0400 |
commit | f6fe40e125a99bd3ea47c476f6a95b6e820a51aa (patch) | |
tree | 0c4675c30d9b2aa556594c3a0e697388269006de /themes/mathlib.h | |
parent | 2074f6be3096386fb543f040dec314290f6eb920 (diff) |
Adding square leaves to the tree
Diffstat (limited to 'themes/mathlib.h')
-rw-r--r-- | themes/mathlib.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/themes/mathlib.h b/themes/mathlib.h index 99dfb62..82f85a2 100644 --- a/themes/mathlib.h +++ b/themes/mathlib.h @@ -21,6 +21,16 @@ #define DEG_TO_RAD(x) (x * (PI / 180.f)) #define RAD_TO_DEG(x) (x * (180.f / PI)) +// -- Random +inline float randomFloatBetween(float min, float max) { + float random = static_cast<float>(rand()) / static_cast<float>(RAND_MAX); + return (max - min) * random + min; +} + +inline int randomIntBetween(int min, int max) { + return static_cast<int>(randomFloatBetween(min, max)); +} + struct Vector2 { float x = 0; float y = 0; |