1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Replace PRNG assertions with PrngException

This commit is contained in:
kwolekr 2015-04-27 01:24:37 -04:00
parent 732eb72a0c
commit cd1d625ab2
3 changed files with 13 additions and 4 deletions

View file

@ -115,7 +115,9 @@ u32 PcgRandom::range(u32 bound)
s32 PcgRandom::range(s32 min, s32 max)
{
assert(max >= min);
if (max < min)
throw PrngException("Invalid range (max < min)");
u32 bound = max - min + 1;
return range(bound) + min;
}