File tree 3 files changed +3
-9
lines changed
3 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -526,7 +526,8 @@ void DocumentData::Shuffle() {
526
526
TRand random ;
527
527
// Different documents get shuffled differently, but the same for the same
528
528
// name.
529
- random .set_seed (document_name_.c_str ());
529
+ std::hash<std::string> hasher;
530
+ random .set_seed (static_cast <uint64_t >(hasher (document_name_)));
530
531
int num_pages = pages_.size ();
531
532
// Execute one random swap for each page in the document.
532
533
for (int i = 0 ; i < num_pages; ++i) {
Original file line number Diff line number Diff line change 24
24
#include < climits> // for INT_MIN, INT_MAX
25
25
#include < cmath> // std::isfinite
26
26
#include < cstdio>
27
- #include < cstring>
28
27
#include < algorithm> // for std::find
29
- #include < functional>
30
28
#include < string>
31
29
#include < vector>
32
30
@@ -77,11 +75,6 @@ class TRand {
77
75
void set_seed (uint64_t seed) {
78
76
seed_ = seed;
79
77
}
80
- // Sets the seed using a hash of a string.
81
- void set_seed (const std::string &str) {
82
- std::hash<std::string> hasher;
83
- set_seed (static_cast <uint64_t >(hasher (str)));
84
- }
85
78
86
79
// Returns an integer in the range 0 to INT32_MAX.
87
80
int32_t IntRand () {
Original file line number Diff line number Diff line change @@ -286,7 +286,7 @@ class TESS_API LSTMRecognizer {
286
286
protected:
287
287
// Sets the random seed from the sample_iteration_;
288
288
void SetRandomSeed () {
289
- int64_t seed = static_cast < int64_t >( sample_iteration_) * 0x10000001 ;
289
+ int64_t seed = sample_iteration_ * 0x10000001LL ;
290
290
randomizer_.set_seed (seed);
291
291
randomizer_.IntRand ();
292
292
}
You can’t perform that action at this time.
0 commit comments