Clear implicit-const-int-float-conversion warnings

This commit is contained in:
Alam Ed Arias 2023-10-17 20:05:48 -04:00
parent 79e2596ce6
commit a5b99199fc

View file

@ -60,7 +60,7 @@ UINT8 M_RandomByte(void)
*/ */
INT32 M_RandomKey(INT32 a) INT32 M_RandomKey(INT32 a)
{ {
return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*a); return (INT32)((rand()/((float)(RAND_MAX)+1.0f))*a);
} }
/** Provides a random integer in a given range. /** Provides a random integer in a given range.
@ -73,7 +73,7 @@ INT32 M_RandomKey(INT32 a)
*/ */
INT32 M_RandomRange(INT32 a, INT32 b) INT32 M_RandomRange(INT32 a, INT32 b)
{ {
return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*(b-a+1))+a; return (INT32)((rand()/((float)(RAND_MAX)+1.0f))*(b-a+1))+a;
} }