mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +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)
|
||||
int operator() (int mod)
|
||||
{
|
||||
return GenRand32() % mod;
|
||||
return (0 == mod)
|
||||
? 0
|
||||
: (GenRand32() % mod);
|
||||
}
|
||||
|
||||
// Returns rand# - rand#
|
||||
|
|
Loading…
Reference in a new issue