mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-23 21:39:13 +02:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user