From e4d35f36643b2913b3a1e404bf22e405c43c6714 Mon Sep 17 00:00:00 2001 From: Alula <6276139+alula@users.noreply.github.com> Date: Fri, 12 Feb 2021 23:48:42 +0100 Subject: [PATCH] rng bugfix --- src/rng.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rng.rs b/src/rng.rs index 5f65c9b..d2b9bdb 100644 --- a/src/rng.rs +++ b/src/rng.rs @@ -5,7 +5,7 @@ pub trait RNG { fn next(&self) -> i32; fn range(&self, range: Range) -> i32 { - range.start + ((self.next() & 0x7fffffff) % (range.len() as i32)) + range.start + ((self.next() & 0x7fffffff) % (range.len() as i32 + 1)) } }