From 0846d5802965d257f176e033d7a6ac353ed648f3 Mon Sep 17 00:00:00 2001 From: majortom6 Date: Sun, 19 Feb 2017 12:00:52 -0600 Subject: -speedcaps now working again -creatures now randomize target better again -thats enough for today, src is still a mess and main can be cleaned a bit --- inc/functions.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'inc/functions.hpp') diff --git a/inc/functions.hpp b/inc/functions.hpp index 7ce9f8d..b0ecb65 100644 --- a/inc/functions.hpp +++ b/inc/functions.hpp @@ -13,4 +13,8 @@ static int map(int x, int inMin, int inMax, int outMin, int outMax){ return (x-inMin) * (outMax - outMin) / (inMax - inMin) + outMin; } +static float getRandom(float x){ + return (-x + static_cast (rand()) / (static_cast (RAND_MAX/(x-(-x))))); +} + #endif -- cgit v1.2.3