From cd1d625ab21e741e91be7d2190bb4fd59fab3200 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Mon, 27 Apr 2015 01:24:37 -0400 Subject: Replace PRNG assertions with PrngException --- src/noise.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/noise.cpp') 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; } -- cgit v1.2.3