aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Rubin <[email protected]>2019-10-28 16:42:39 -0700
committerJeremy Rubin <[email protected]>2019-10-28 16:42:39 -0700
commita35b6824f3a0bdb68c5aef599c0f17562689970e (patch)
tree05072617dfd5744371e411931cfce6a6a8bf3450 /src
parentMerge #17279: refactor: Remove redundant c_str() calls in formatting (diff)
downloaddiscoin-a35b6824f3a0bdb68c5aef599c0f17562689970e.tar.xz
discoin-a35b6824f3a0bdb68c5aef599c0f17562689970e.zip
Add assertion to randrange that input is not 0
Diffstat (limited to 'src')
-rw-r--r--src/random.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/random.h b/src/random.h
index 22801ec15..9d1f75177 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) {