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:
parent
732eb72a0c
commit
cd1d625ab2
3 changed files with 13 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue