浏览代码

Arrange dem_main.c : remove usage of /dev/random

Olivier Marty 8 年之前
父节点
当前提交
caa0d80b6a
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/discr_calc/dem_main.c

+ 6 - 3
src/discr_calc/dem_main.c

@@ -19,9 +19,12 @@ int main(int argc, char **argv)
 
   FILE *random;
   unsigned int seed;
-  random = fopen("/dev/random", "rb");
-  fread(&seed, 4, 1, random);
-  srand(seed);
+  //random = fopen("/dev/random", "rb");
+  //fread(&seed, 4, 1, random);
+  //srand(seed);
+  // sometimes /dev/random is really slow (at least on my computer)...
+  // we do :
+  srand(time(NULL)+getpid());
 
 
   switch (argc) {