From 197767d1c83f8d940698cd200785e91fbc2ccc98 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 29 May 2019 21:02:58 +0300 Subject: Updates, CTimer started --- src/General.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/General.h') 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)); } }; -- cgit v1.2.3 From 64f9dfbb89db50eabe30c94a89b5a5e4b5730a5f Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 29 May 2019 21:05:50 +0300 Subject: fix --- src/General.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/General.h') diff --git a/src/General.h b/src/General.h index 38737bd5..1dec2d54 100644 --- a/src/General.h +++ b/src/General.h @@ -14,8 +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()/float(RAND_MAX + 1)); } + { return low + (high - low)*(GetRandomNumber()/float(MY_RAND_MAX + 1)); } static Int32 GetRandomNumberInRange(Int32 low, Int32 high) - { return low + (high - low)*(GetRandomNumber()/float(RAND_MAX + 1)); } + { return low + (high - low)*(GetRandomNumber()/float(MY_RAND_MAX + 1)); } }; -- cgit v1.2.3