mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Add assertion to randrange that input is not 0
This commit is contained in:
parent
4c1090c882
commit
a35b6824f3
1 changed files with 1 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue