diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-02-01 17:06:32 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-02-02 14:12:01 -0500 |
commit | fae169c95e09ddf068dcaebc8170c4f41b02cf66 (patch) | |
tree | 3d3072afbe6fafd6711dd6085001a8320662c28d /src/random.cpp | |
parent | 3e38d4087379edd1c0730d058902f527d5da6358 (diff) |
test: Make bloom tests deterministic
Diffstat (limited to 'src/random.cpp')
-rw-r--r-- | src/random.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/random.cpp b/src/random.cpp index 3b7f7910b0..3277c34d3f 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -514,9 +514,11 @@ void GetRandBytes(unsigned char* buf, int num) noexcept { ProcRand(buf, num, RNG void GetStrongRandBytes(unsigned char* buf, int num) noexcept { ProcRand(buf, num, RNGLevel::SLOW); } void RandAddSeedSleep() { ProcRand(nullptr, 0, RNGLevel::SLEEP); } +bool g_mock_deterministic_tests{false}; + uint64_t GetRand(uint64_t nMax) noexcept { - return FastRandomContext().randrange(nMax); + return FastRandomContext(g_mock_deterministic_tests).randrange(nMax); } int GetRandInt(int nMax) noexcept |