mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
[util] Add method that returns random time in milliseconds
This commit is contained in:
parent
89eeb4a333
commit
7e93eecce3
2 changed files with 6 additions and 0 deletions
|
@ -592,6 +592,11 @@ std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max)
|
||||||
return std::chrono::microseconds{GetRand(duration_max.count())};
|
return std::chrono::microseconds{GetRand(duration_max.count())};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::chrono::milliseconds GetRandMillis(std::chrono::milliseconds duration_max) noexcept
|
||||||
|
{
|
||||||
|
return std::chrono::milliseconds{GetRand(duration_max.count())};
|
||||||
|
}
|
||||||
|
|
||||||
int GetRandInt(int nMax) noexcept
|
int GetRandInt(int nMax) noexcept
|
||||||
{
|
{
|
||||||
return GetRand(nMax);
|
return GetRand(nMax);
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
void GetRandBytes(unsigned char* buf, int num) noexcept;
|
void GetRandBytes(unsigned char* buf, int num) noexcept;
|
||||||
uint64_t GetRand(uint64_t nMax) noexcept;
|
uint64_t GetRand(uint64_t nMax) noexcept;
|
||||||
std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max) noexcept;
|
std::chrono::microseconds 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;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue