Changeset View
Changeset View
Standalone View
Standalone View
src/random.h
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
* necessarily meaningfully add entropy to the PRNG state. | * necessarily meaningfully add entropy to the PRNG state. | ||||
* | * | ||||
* Thread-safe. | * Thread-safe. | ||||
*/ | */ | ||||
void GetRandBytes(uint8_t *buf, int num) noexcept; | void GetRandBytes(uint8_t *buf, int num) noexcept; | ||||
uint64_t GetRand(uint64_t nMax) noexcept; | uint64_t GetRand(uint64_t nMax) noexcept; | ||||
std::chrono::microseconds | std::chrono::microseconds | ||||
GetRandMicros(std::chrono::microseconds duration_max) noexcept; | GetRandMicros(std::chrono::microseconds duration_max) noexcept; | ||||
std::chrono::milliseconds | |||||
GetRandMillis(std::chrono::milliseconds duration_max) noexcept; | |||||
int GetRandInt(int nMax) noexcept; | int GetRandInt(int nMax) noexcept; | ||||
uint256 GetRandHash() noexcept; | uint256 GetRandHash() noexcept; | ||||
/** | /** | ||||
* Gather entropy from various sources, feed it into the internal PRNG, and | * Gather entropy from various sources, feed it into the internal PRNG, and | ||||
* generate random data using it. | * generate random data using it. | ||||
* | * | ||||
* This function will cause failure whenever the OS RNG fails. | * This function will cause failure whenever the OS RNG fails. | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |