diff options
| author | MarcoFalke <[email protected]> | 2019-02-01 17:06:32 -0500 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2019-02-02 14:12:01 -0500 |
| commit | fae169c95e09ddf068dcaebc8170c4f41b02cf66 (patch) | |
| tree | 3d3072afbe6fafd6711dd6085001a8320662c28d /src/random.cpp | |
| parent | Merge #15235: Do not import private keys to wallets with private keys disabled (diff) | |
| download | discoin-fae169c95e09ddf068dcaebc8170c4f41b02cf66.tar.xz discoin-fae169c95e09ddf068dcaebc8170c4f41b02cf66.zip | |
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 3b7f7910b..3277c34d3 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 |