Fixed a buffer overflow.
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
* @param b Number to modulo with. (a % b)
|
||||
* @returns The modulo result.
|
||||
*/
|
||||
#define mathMod(a,b) (a%b+b)%b
|
||||
#define mathMod(a,b) ((a)%(b)+(b))%(b)
|
||||
|
||||
/**
|
||||
* Returns the modulous a result for b. Works for floating point numbers.
|
||||
|
@ -42,7 +42,7 @@
|
||||
* @param max Maximum value to generate to. (Exclusive)
|
||||
* @return Random number between min and max.
|
||||
*/
|
||||
#define randRange(n, min, max) (mathMod(n, max - min) + min)
|
||||
#define randRange(n, min, max) (mathMod(n, (max-min)) + min)
|
||||
|
||||
#define randInt32Range(min, max) randRange(randInt32(), min, max)
|
||||
#define randFloatRange(min, max) (fmod(randFloat(), max- min) + min)
|
||||
|
Reference in New Issue
Block a user