mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Fixed division by zero in RNG
Random number generator now returns zero for range [0, 0)
This commit is contained in:
parent
f1cd22ef34
commit
02ff3291bd
1 changed files with 3 additions and 1 deletions
|
@ -57,7 +57,9 @@ public:
|
||||||
// Returns a random number in the range [0,mod)
|
// Returns a random number in the range [0,mod)
|
||||||
int operator() (int mod)
|
int operator() (int mod)
|
||||||
{
|
{
|
||||||
return GenRand32() % mod;
|
return (0 == mod)
|
||||||
|
? 0
|
||||||
|
: (GenRand32() % mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns rand# - rand#
|
// Returns rand# - rand#
|
||||||
|
|
Loading…
Reference in a new issue