aboutsummaryrefslogtreecommitdiff
path: root/src/random.h
diff options
context:
space:
mode:
authorpasta <pasta@dashboost.org>2022-01-31 19:29:33 +0700
committerpasta <pasta@dashboost.org>2022-03-23 17:36:33 -0500
commit3ae7791bcaa88f5c68592673b8926ee807242ce7 (patch)
treea3c9f0be42e9082a9047f26d4eecb65b441e39a8 /src/random.h
parentcea230eec40054a82fcd31fa97cf46f1585c4a35 (diff)
downloadbitcoin-3ae7791bcaa88f5c68592673b8926ee807242ce7.tar.xz
refactor: use Span in random.*
Diffstat (limited to 'src/random.h')
-rw-r--r--src/random.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/random.h b/src/random.h
index 97302d61ab..285158b1c3 100644
--- a/src/random.h
+++ b/src/random.h
@@ -8,6 +8,7 @@
#include <crypto/chacha20.h>
#include <crypto/common.h>
+#include <span.h>
#include <uint256.h>
#include <chrono>
@@ -66,7 +67,7 @@
*
* Thread-safe.
*/
-void GetRandBytes(unsigned char* buf, int num) noexcept;
+void GetRandBytes(Span<unsigned char> bytes) noexcept;
/** Generate a uniform random integer in the range [0..range). Precondition: range > 0 */
uint64_t GetRand(uint64_t nMax) noexcept;
/** Generate a uniform random duration in the range [0..max). Precondition: max.count() > 0 */
@@ -105,7 +106,7 @@ uint256 GetRandHash() noexcept;
*
* Thread-safe.
*/
-void GetStrongRandBytes(unsigned char* buf, int num) noexcept;
+void GetStrongRandBytes(Span<unsigned char> bytes) noexcept;
/**
* Gather entropy from various expensive sources, and feed them to the PRNG state.