summaryrefslogtreecommitdiff
path: root/src/noise.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-04-27 01:24:37 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-27 01:24:37 -0400
commitcd1d625ab21e741e91be7d2190bb4fd59fab3200 (patch)
treecc11bc4b971be5712d3aaaf55d3b4697c4876f30 /src/noise.cpp
parent732eb72a0c4e2fb4632b0f42762d102e0d98dffa (diff)
downloadminetest-cd1d625ab21e741e91be7d2190bb4fd59fab3200.tar.gz
minetest-cd1d625ab21e741e91be7d2190bb4fd59fab3200.tar.bz2
minetest-cd1d625ab21e741e91be7d2190bb4fd59fab3200.zip
Replace PRNG assertions with PrngException
Diffstat (limited to 'src/noise.cpp')
-rw-r--r--src/noise.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/noise.cpp b/src/noise.cpp
index 4bfc46f15..2e4588124 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -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;
}