Просмотр исходного кода

methods/mirror.cc: init random seed at startup

Michael Vogt лет назад: 15
Родитель
Сommit
0190e315a3
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      methods/mirror.cc

+ 3 - 1
methods/mirror.cc

@@ -157,7 +157,7 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file)
 
    // read 
    ifstream in(mirror_file.c_str());
-   while ( ! in.eof() ) {
+   while ( !in.eof() ) {
       getline(in, line);
       content.push_back(line);
    }
@@ -403,6 +403,8 @@ int main()
 {
    setlocale(LC_ALL, "");
 
+   srand ( time(NULL) );
+
    MirrorMethod Mth;
 
    return Mth.Loop();