mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Merge pull request #461 from alexey-lysiuk/fix_zerodiv_random
Fixed division by zero in RNG
This commit is contained in:
commit
a83d189a9c
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