random: drop ad-hoc Shuffle in favor of std::shuffle

Benchmarks show it is no longer faster with modern standard C++ libraries,
and the debug-mode failure due to self-move has been fixed as well.
This commit is contained in:
Pieter Wuille
2024-07-05 10:45:54 -04:00
parent da28a26aae
commit 6ecda04fef
14 changed files with 19 additions and 61 deletions

View File

@@ -392,7 +392,7 @@ void BuildBigPriorityTest(Scenario& scenario, int peers)
// Determine the announcement order randomly.
std::vector<NodeId> announce_order = request_order;
Shuffle(announce_order.begin(), announce_order.end(), g_insecure_rand_ctx);
std::shuffle(announce_order.begin(), announce_order.end(), g_insecure_rand_ctx);
// Find a gtxid whose txhash prioritization is consistent with the required ordering within pref_peers and
// within npref_peers.
@@ -697,7 +697,7 @@ void TestInterleavedScenarios()
builders.emplace_back([](Scenario& scenario){ BuildWeirdRequestsTest(scenario); });
}
// Randomly shuffle all those functions.
Shuffle(builders.begin(), builders.end(), g_insecure_rand_ctx);
std::shuffle(builders.begin(), builders.end(), g_insecure_rand_ctx);
Runner runner;
auto starttime = RandomTime1y();