Skip to content

Commit 7e93eec

Browse files
committed
[util] Add method that returns random time in milliseconds
1 parent 89eeb4a commit 7e93eec

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/random.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,11 @@ std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max)
592592
return std::chrono::microseconds{GetRand(duration_max.count())};
593593
}
594594

595+
std::chrono::milliseconds GetRandMillis(std::chrono::milliseconds duration_max) noexcept
596+
{
597+
return std::chrono::milliseconds{GetRand(duration_max.count())};
598+
}
599+
595600
int GetRandInt(int nMax) noexcept
596601
{
597602
return GetRand(nMax);

src/random.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
void GetRandBytes(unsigned char* buf, int num) noexcept;
7070
uint64_t GetRand(uint64_t nMax) noexcept;
7171
std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max) noexcept;
72+
std::chrono::milliseconds GetRandMillis(std::chrono::milliseconds duration_max) noexcept;
7273
int GetRandInt(int nMax) noexcept;
7374
uint256 GetRandHash() noexcept;
7475

0 commit comments

Comments
 (0)