diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-04-27 09:25:05 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-04-30 09:19:14 -0400 |
commit | fa0e5b89cf742df56c6c8f49fe9b3c54d2970a66 (patch) | |
tree | 510c91dbf42bb275803df45311ed19f5e04d861a /src/random.cpp | |
parent | af2ec6b03745cf408f169cfbd74e3380a69975e0 (diff) |
Add templated GetRandomDuration<>
Diffstat (limited to 'src/random.cpp')
-rw-r--r-- | src/random.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/random.cpp b/src/random.cpp index b408b1e13e..27d8367de4 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -14,16 +14,14 @@ #include <wincrypt.h> #endif #include <logging.h> // for LogPrintf() +#include <randomenv.h> +#include <support/allocators/secure.h> #include <sync.h> // for Mutex #include <util/time.h> // for GetTimeMicros() #include <stdlib.h> #include <thread> -#include <randomenv.h> - -#include <support/allocators/secure.h> - #ifndef WIN32 #include <fcntl.h> #include <sys/time.h> @@ -587,16 +585,6 @@ uint64_t GetRand(uint64_t nMax) noexcept return FastRandomContext(g_mock_deterministic_tests).randrange(nMax); } -std::chrono::microseconds GetRandMicros(std::chrono::microseconds duration_max) noexcept -{ - 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 { return GetRand(nMax); |