diff options
author | Jeremy Rubin <j@rubin.io> | 2019-10-28 16:42:39 -0700 |
---|---|---|
committer | Jeremy Rubin <j@rubin.io> | 2019-10-28 16:42:39 -0700 |
commit | a35b6824f3a0bdb68c5aef599c0f17562689970e (patch) | |
tree | 05072617dfd5744371e411931cfce6a6a8bf3450 /src | |
parent | 4c1090c882ea15ba4d10a2f7f320f3c0eb490ebd (diff) | |
download | bitcoin-a35b6824f3a0bdb68c5aef599c0f17562689970e.tar.xz |
Add assertion to randrange that input is not 0
Diffstat (limited to 'src')
-rw-r--r-- | src/random.h | 1 |
1 files changed, 1 insertions, 0 deletions
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) { |