diff --git a/src/io/iter_image_recordio.cc b/src/io/iter_image_recordio.cc index e8dcbef2e909..fdb88cc3f366 100644 --- a/src/io/iter_image_recordio.cc +++ b/src/io/iter_image_recordio.cc @@ -264,6 +264,8 @@ class ImageRecordIter : public IIterator { parser_.Init(kwargs); // prefetch at most 4 minbatches iter_.set_max_capacity(4); + // set random seed + rnd_.seed(kRandMagic + param_.seed); // init thread iter iter_.Init([this](std::vector> **dptr) { if (*dptr == nullptr) { @@ -273,7 +275,6 @@ class ImageRecordIter : public IIterator { }, [this]() { parser_.BeforeFirst(); }); inst_ptr_ = 0; - rnd_.seed(kRandMagic + param_.seed); } // before first virtual void BeforeFirst(void) {