Skip to content

Commit

Permalink
Merge pull request #2492 from jbarlow83/fix-text2image
Browse files Browse the repository at this point in the history
Fix text2image compilation on C++17 compilers
  • Loading branch information
zdenop authored Jun 14, 2019
2 parents 3c50710 + a9890af commit 3afc946
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/training/text2image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <algorithm>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3afc946

Please sign in to comment.