diff options
author | majortom6 <tombarrett@siu.edu> | 2017-02-26 07:07:11 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-03-07 13:23:42 -0600 |
commit | 72b40aec2addc7b28170ba9364bc0429149b3299 (patch) | |
tree | c84358c619784a418adb4d0d71c6e91ccddc7f89 /inc/functions.hpp | |
parent | c6d10c3d73e99043a29897eecf59656a18db989d (diff) |
-added more detailed mutation function, eventually a normal distrobution will be implemented
-added roll function, which takes a float ie (.15) and returns a true that percent of the time
Diffstat (limited to 'inc/functions.hpp')
-rw-r--r-- | inc/functions.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/inc/functions.hpp b/inc/functions.hpp index b0ecb65..ef6d555 100644 --- a/inc/functions.hpp +++ b/inc/functions.hpp @@ -1,6 +1,7 @@ #ifndef functions_h #define functions_h +#include <cstdlib> #include <cmath> #include "rectangle.hpp" @@ -17,4 +18,11 @@ static float getRandom(float x){ return (-x + static_cast <float> (rand()) / (static_cast <float> (RAND_MAX/(x-(-x))))); } +static bool roll(float x){ + float y = (float)(rand()%101)/100; + if(x >= y) + return true; + else + return false; +} #endif |