aboutsummaryrefslogtreecommitdiff
path: root/src/random.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-02-01 17:06:32 -0500
committerMarcoFalke <falke.marco@gmail.com>2019-02-02 14:12:01 -0500
commitfae169c95e09ddf068dcaebc8170c4f41b02cf66 (patch)
tree3d3072afbe6fafd6711dd6085001a8320662c28d /src/random.cpp
parent3e38d4087379edd1c0730d058902f527d5da6358 (diff)
test: Make bloom tests deterministic
Diffstat (limited to 'src/random.cpp')
-rw-r--r--src/random.cpp4
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