Replace random_shuffle with shuffle.
random_shuffle is removed in C++17.
Before:
std::random_shuffle(data.begin(), data.end());
After:
std::random_device rd;
std::mt19937 urbg(rd());
std::shuffle(data.begin(), data.end(), urbg);
We don't use absl::SharedBitGen() yet, because our implementation for
some platforms (i.e. ChromeOS, Win, Mac) does not use absl yet.
REF_BUG=73273409
REF_CL=185618579,185625030
REF_TIME=2018-02-14T11:00:03+09:00
REF_TIME_RAW=1518573603 +0900
Hiroyuki Komatsu
6 years ago
30 | 30 |
|
31 | 31 |
#include <algorithm>
|
32 | 32 |
#include <memory>
|
|
33 |
#include <random>
|
33 | 34 |
#include <string>
|
34 | 35 |
#include <vector>
|
35 | 36 |
|
|
72 | 73 |
|
73 | 74 |
for (int trial = 0; trial < 3; ++trial) {
|
74 | 75 |
// Lookup in random order for a few times.
|
75 | |
std::random_shuffle(data.begin(), data.end());
|
|
76 |
std::random_device rd;
|
|
77 |
std::mt19937 urbg(rd());
|
|
78 |
std::shuffle(data.begin(), data.end(), urbg);
|
76 | 79 |
for (size_t i = 0; i < data.size(); ++i) {
|
77 | 80 |
int actual = connector->GetTransitionCost(data[i].rid, data[i].lid);
|
78 | 81 |
EXPECT_EQ(data[i].cost, actual);
|
29 | 29 |
|
30 | 30 |
MAJOR=2
|
31 | 31 |
MINOR=23
|
32 | |
BUILD=2807
|
|
32 |
BUILD=2808
|
33 | 33 |
REVISION=102
|
34 | 34 |
# This version represents the version of Mozc IME engine (converter, predictor,
|
35 | 35 |
# etc.). This version info is included both in the Mozc server and in the Mozc
|
31 | 31 |
#include <algorithm>
|
32 | 32 |
#include <cstring>
|
33 | 33 |
#include <memory>
|
|
34 |
#include <random>
|
34 | 35 |
#include <sstream>
|
35 | 36 |
#include <string>
|
36 | 37 |
#include <vector>
|
|
631 | 632 |
dic->SetUserDictionaryName(filename);
|
632 | 633 |
|
633 | 634 |
for (int i = 0; i < 32; ++i) {
|
634 | |
std::random_shuffle(keys.begin(), keys.end());
|
|
635 |
std::random_device rd;
|
|
636 |
std::mt19937 urbg(rd());
|
|
637 |
std::shuffle(keys.begin(), keys.end(), urbg);
|
635 | 638 |
dic->Reload();
|
636 | 639 |
for (int i = 0; i < 1000; ++i) {
|
637 | 640 |
CollectTokenCallback callback;
|
30 | 30 |
|
31 | 31 |
#include <algorithm>
|
32 | 32 |
#include <memory>
|
|
33 |
#include <random>
|
33 | 34 |
#include <set>
|
34 | 35 |
#include <string>
|
35 | 36 |
#include <utility>
|
|
3044 | 3045 |
result->SetTypesAndTokenAttributes(TestableDictionaryPredictor::REALTIME,
|
3045 | 3046 |
Token::NONE);
|
3046 | 3047 |
}
|
3047 | |
std::random_shuffle(results.begin(), results.end());
|
|
3048 |
std::random_device rd;
|
|
3049 |
std::mt19937 urbg(rd());
|
|
3050 |
std::shuffle(results.begin(), results.end(), urbg);
|
3048 | 3051 |
|
3049 | 3052 |
Segments segments;
|
3050 | 3053 |
MakeSegmentsForSuggestion("test", &segments);
|
30 | 30 |
|
31 | 31 |
#include <algorithm>
|
32 | 32 |
#include <memory>
|
|
33 |
#include <random>
|
33 | 34 |
#include <string>
|
34 | 35 |
#include <vector>
|
35 | 36 |
|
|
208 | 209 |
clock.PutClockForward(interval_time, 0);
|
209 | 210 |
}
|
210 | 211 |
|
211 | |
std::random_shuffle(ids.begin(), ids.end());
|
|
212 |
std::random_device rd;
|
|
213 |
std::mt19937 urbg(rd());
|
|
214 |
std::shuffle(ids.begin(), ids.end(), urbg);
|
212 | 215 |
const uint64 oldest_id = ids[0];
|
213 | 216 |
for (size_t i = 0; i < session_size; ++i) {
|
214 | 217 |
EXPECT_TRUE(IsGoodSession(&handler, ids[i]));
|