mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-23 15:22:46 +02:00
Add assertion to randrange that input is not 0
This commit is contained in:
parent
4c1090c882
commit
a35b6824f3
@ -166,6 +166,7 @@ public:
|
|||||||
/** Generate a random integer in the range [0..range). */
|
/** Generate a random integer in the range [0..range). */
|
||||||
uint64_t randrange(uint64_t range) noexcept
|
uint64_t randrange(uint64_t range) noexcept
|
||||||
{
|
{
|
||||||
|
assert(range);
|
||||||
--range;
|
--range;
|
||||||
int bits = CountBits(range);
|
int bits = CountBits(range);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user