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:
Nay committed 2012-10-07 12:55:51 +01:00
1 parent 26b998d94c
commit 99175e066c
1 file changed
+3
+3
View File
@@ -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);
}