diff --git a/fdbclient/MonitorLeader.actor.cpp b/fdbclient/MonitorLeader.actor.cpp index 345fcbc280..6210eb8810 100644 --- a/fdbclient/MonitorLeader.actor.cpp +++ b/fdbclient/MonitorLeader.actor.cpp @@ -237,12 +237,12 @@ TEST_CASE("/flow/FlatBuffers/LeaderInfo") { { LeaderInfo in; LeaderInfo out; - in.forward = g_random->coinflip(); - in.changeID = g_random->randomUniqueID(); + in.forward = deterministicRandom()->coinflip(); + in.changeID = deterministicRandom()->randomUniqueID(); { - std::string rndString(g_random->randomInt(10, 400), 'x'); + std::string rndString(deterministicRandom()->randomInt(10, 400), 'x'); for (auto& c : rndString) { - c = g_random->randomAlphaNumeric(); + c = deterministicRandom()->randomAlphaNumeric(); } in.serializedInfo = rndString; } @@ -256,12 +256,12 @@ TEST_CASE("/flow/FlatBuffers/LeaderInfo") { ASSERT(in.serializedInfo == out.serializedInfo); } LeaderInfo leaderInfo; - leaderInfo.forward = g_random->coinflip(); - leaderInfo.changeID = g_random->randomUniqueID(); + leaderInfo.forward = deterministicRandom()->coinflip(); + leaderInfo.changeID = deterministicRandom()->randomUniqueID(); { - std::string rndString(g_random->randomInt(10, 400), 'x'); + std::string rndString(deterministicRandom()->randomInt(10, 400), 'x'); for (auto& c : rndString) { - c = g_random->randomAlphaNumeric(); + c = deterministicRandom()->randomAlphaNumeric(); } leaderInfo.serializedInfo = rndString; } diff --git a/fdbserver/DiskQueue.actor.cpp b/fdbserver/DiskQueue.actor.cpp index 48de37b6c8..cfcbe091a0 100644 --- a/fdbserver/DiskQueue.actor.cpp +++ b/fdbserver/DiskQueue.actor.cpp @@ -342,7 +342,7 @@ public: // Either shrink self->files[1] to the size of self->files[0], or chop off fileShrinkBytes int64_t maxShrink = pageFloor( std::max( self->files[1].size - desiredMaxFileSize, self->fileShrinkBytes ) ); if ((maxShrink > SERVER_KNOBS->DISK_QUEUE_MAX_TRUNCATE_BYTES) || - (frivolouslyTruncate && g_random->random01() < 0.3)) { + (frivolouslyTruncate && deterministicRandom()->random01() < 0.3)) { TEST(true); // Replacing DiskQueue file TraceEvent("DiskQueueReplaceFile", self->dbgid).detail("Filename", self->files[1].f->getFilename()).detail("OldFileSize", self->files[1].size).detail("ElidedTruncateSize", maxShrink); Reference newFile = wait( replaceFile(self->files[1].f) ); diff --git a/flow/flat_buffers.cpp b/flow/flat_buffers.cpp index 00546098d7..d4c1ddcdf2 100644 --- a/flow/flat_buffers.cpp +++ b/flow/flat_buffers.cpp @@ -490,9 +490,9 @@ TEST_CASE("/flow/FlatBuffers/VectorRef") { TEST_CASE("/flow/FlatBuffers/Standalone") { Standalone> vecIn; - auto numElements = g_random->randomInt(1, 20); + auto numElements = deterministicRandom()->randomInt(1, 20); for (int i = 0; i < numElements; ++i) { - auto str = g_random->randomAlphaNumeric(g_random->randomInt(0, 30)); + auto str = deterministicRandom()->randomAlphaNumeric(deterministicRandom()->randomInt(0, 30)); vecIn.push_back(vecIn.arena(), StringRef(vecIn.arena(), str)); } Standalone value = ObjectWriter::toValue(vecIn); diff --git a/flow/flow.cpp b/flow/flow.cpp index 2b686457cf..d96ce52344 100644 --- a/flow/flow.cpp +++ b/flow/flow.cpp @@ -257,7 +257,7 @@ TEST_CASE("/flow/FlatBuffers/ErrorOr") { ASSERT(out.getError().code() == in.getError().code()); } { - ErrorOr in(g_random->randomUInt32()); + ErrorOr in(deterministicRandom()->randomUInt32()); ErrorOr out; ObjectWriter writer; writer.serialize(in); @@ -282,7 +282,7 @@ TEST_CASE("/flow/FlatBuffers/Optional") { ASSERT(!out.present()); } { - Optional in(g_random->randomUInt32()); + Optional in(deterministicRandom()->randomUInt32()); Optional out; ObjectWriter writer; writer.serialize(in);