diff options
Diffstat (limited to 'src/General.h')
-rw-r--r-- | src/General.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/General.h b/src/General.h index 7aacee39..38737bd5 100644 --- a/src/General.h +++ b/src/General.h @@ -1,3 +1,6 @@ + + + class CGeneral { public: @@ -11,5 +14,8 @@ public: { return myrand() & 0xFFFF; } // Probably don't want to ever reach high static float GetRandomNumberInRange(float low, float high) - { return low + (high - low)*(GetRandomNumber()/65536.0f); } + { return low + (high - low)*(GetRandomNumber()/float(RAND_MAX + 1)); } + + static Int32 GetRandomNumberInRange(Int32 low, Int32 high) + { return low + (high - low)*(GetRandomNumber()/float(RAND_MAX + 1)); } }; |