blob: c6f8c48f17e1b26dddc919a2af016b7aca35a595 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--- contrib/restricted/thrift/thrift/transport/TSocketPool.cpp (index)
+++ contrib/restricted/thrift/thrift/transport/TSocketPool.cpp (working tree)
@@ -21,11 +21,13 @@
#include <algorithm>
#include <iostream>
+#if __cplusplus >= 201703L
+#include <random>
+#endif
#include <thrift/transport/TSocketPool.h>
using std::pair;
-using std::random_shuffle;
using std::string;
using std::vector;
@@ -189,7 +191,13 @@ void TSocketPool::open() {
}
if (randomize_ && numServers > 1) {
- random_shuffle(servers_.begin(), servers_.end());
+#if __cplusplus >= 201703L
+ std::random_device rng;
+ std::mt19937 urng(rng());
+ std::shuffle(servers_.begin(), servers_.end(), urng);
+#else
+ std::random_shuffle(servers_.begin(), servers_.end());
+#endif
}
for (size_t i = 0; i < numServers; ++i) {
|