From f6fe40e125a99bd3ea47c476f6a95b6e820a51aa Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Wed, 13 Oct 2021 07:29:09 -0400 Subject: Adding square leaves to the tree --- themes/mathlib.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'themes/mathlib.h') 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(rand()) / static_cast(RAND_MAX); + return (max - min) * random + min; +} + +inline int randomIntBetween(int min, int max) { + return static_cast(randomFloatBetween(min, max)); +} + struct Vector2 { float x = 0; float y = 0; -- cgit v1.2.1