Skip to content

Commit 2c07e61

Browse files
committed
TEST/IODEMO: Use std::shuffle when available
random_shuffle was deprecated in C++14 and completely removed in C++17. With newer compilers like Clang 21, the build fails. This commit should preserve older behavior and use std::shuffle when available. Signed-off-by: Brahmajit Das <[email protected]>
1 parent 272967a commit 2c07e61

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/apps/iodemo/io_demo.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <csignal>
2020
#include <cerrno>
2121
#include <vector>
22+
#include <random>
2223
#include <map>
2324
#include <queue>
2425
#include <algorithm>
@@ -2999,8 +3000,9 @@ static int do_client(options_t& test_opts)
29993000
LOG << "random seed: " << test_opts.random_seed;
30003001

30013002
// randomize servers to optimize startup
3002-
std::random_shuffle(test_opts.servers.begin(), test_opts.servers.end(),
3003-
IoDemoRandom::urand<size_t>);
3003+
std::random_device rd;
3004+
std::mt19937 rng(rd());
3005+
std::shuffle(test_opts.servers.begin(), test_opts.servers.end(), rng);
30043006

30053007
UcxLog vlog(LOG_PREFIX, test_opts.verbose);
30063008
vlog << "List of servers:";

0 commit comments

Comments
 (0)