aboutsummaryrefslogtreecommitdiff
path: root/src/random.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/random.h')
-rw-r--r--src/random.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/random.h b/src/random.h
index 76bae5838d..f7c20ee4b0 100644
--- a/src/random.h
+++ b/src/random.h
@@ -11,6 +11,7 @@
#include <span.h>
#include <uint256.h>
+#include <bit>
#include <cassert>
#include <chrono>
#include <cstdint>
@@ -203,7 +204,7 @@ public:
{
assert(range);
--range;
- int bits = CountBits(range);
+ int bits = std::bit_width(range);
while (true) {
uint64_t ret = randbits(bits);
if (ret <= range) return ret;