diff options
author | majortom6 <tombarrett@siu.edu> | 2017-02-19 12:00:52 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-03-07 13:23:41 -0600 |
commit | 0846d5802965d257f176e033d7a6ac353ed648f3 (patch) | |
tree | 1ada2e260970883decd2165d3dd3b74ad34212fd /inc/functions.hpp | |
parent | bfdc713b68dd6f8d61e7b26fc2cff15caf24b44d (diff) |
-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
Diffstat (limited to 'inc/functions.hpp')
-rw-r--r-- | inc/functions.hpp | 4 |
1 files changed, 4 insertions, 0 deletions
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 <float> (rand()) / (static_cast <float> (RAND_MAX/(x-(-x))))); +} + #endif |