Merge pull request #2492 from jbarlow83/fix-text2image

Fix text2image compilation on C++17 compilers
This commit is contained in:
zdenop 2019-06-14 07:45:14 +02:00 committed by GitHub
commit 3afc946d5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,7 @@
#include <algorithm>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <utility>
#include <vector>
@ -573,8 +574,11 @@ static int Main() {
offset += step;
offset += SpanUTF8Whitespace(str8 + offset);
}
if (FLAGS_render_ngrams)
std::random_shuffle(offsets.begin(), offsets.end());
if (FLAGS_render_ngrams) {
std::seed_seq seed{kRandomSeed};
std::mt19937 random_gen(seed);
std::shuffle(offsets.begin(), offsets.end(), random_gen);
}
for (size_t i = 0, line = 1; i < offsets.size(); ++i) {
const char *curr_pos = str8 + offsets[i].first;