Core/Utils: Add asserts to irand, urand and frand
max should always be higher or equal than min notice that SFMT was already covering these cases and it would return 0, -1 or min
This commit is contained in:
1 parent
26b998d94c
commit
99175e066c
1 file changed
+3
@@ -28,16 +28,19 @@ static SFMTRandTSS sfmtRand;
|
||||
|
||||
int32 irand(int32 min, int32 max)
|
||||
{
|
||||
assert(max >= min);
|
||||
return int32(sfmtRand->IRandom(min, max));
|
||||
}
|
||||
|
||||
uint32 urand(uint32 min, uint32 max)
|
||||
{
|
||||
assert(max >= min);
|
||||
return sfmtRand->URandom(min, max);
|
||||
}
|
||||
|
||||
float frand(float min, float max)
|
||||
{
|
||||
assert(max >= min);
|
||||
return float(sfmtRand->Random() * (max - min) + min);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user