From a35b6824f3a0bdb68c5aef599c0f17562689970e Mon Sep 17 00:00:00 2001 From: Jeremy Rubin Date: Mon, 28 Oct 2019 16:42:39 -0700 Subject: Add assertion to randrange that input is not 0 --- src/random.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/random.h b/src/random.h index 22801ec155..9d1f751773 100644 --- a/src/random.h +++ b/src/random.h @@ -166,6 +166,7 @@ public: /** Generate a random integer in the range [0..range). */ uint64_t randrange(uint64_t range) noexcept { + assert(range); --range; int bits = CountBits(range); while (true) { -- cgit v1.2.3