aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/client/client_channel_stress_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/client/client_channel_stress_test.cc')
-rw-r--r--test/cpp/client/client_channel_stress_test.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc
index e829d5278b..80d1583333 100644
--- a/test/cpp/client/client_channel_stress_test.cc
+++ b/test/cpp/client/client_channel_stress_test.cc
@@ -19,6 +19,7 @@
#include <atomic>
#include <memory>
#include <mutex>
+#include <random>
#include <sstream>
#include <thread>
@@ -104,8 +105,8 @@ class BalancerServiceImpl : public LoadBalancer::Service {
for (size_t i = 0; i < num_drop_entry; ++i) {
random_backend_indices.push_back(-1);
}
- std::random_shuffle(random_backend_indices.begin(),
- random_backend_indices.end());
+ std::shuffle(random_backend_indices.begin(), random_backend_indices.end(),
+ std::mt19937(std::random_device()()));
// Build the response according to the random list generated above.
LoadBalanceResponse response;
for (int index : random_backend_indices) {
@@ -149,7 +150,8 @@ class ClientChannelStressTest {
addresses.emplace_back(AddressData{balancer_server.port_, true, ""});
}
}
- std::random_shuffle(addresses.begin(), addresses.end());
+ std::shuffle(addresses.begin(), addresses.end(),
+ std::mt19937(std::random_device()()));
SetNextResolution(addresses);
std::this_thread::sleep_for(wait_duration);
}