diff --git a/Timer.cpp b/Timer.cpp index 89d5280..41b3479 100644 --- a/Timer.cpp +++ b/Timer.cpp @@ -110,16 +110,14 @@ std::string Timer::getSeed(int size) { #else - FILE *f = fopen("/dev/random","rb"); + FILE *f = fopen("/dev/urandom","rb"); if(f==NULL) { - printf("Failed to open /dev/random %s\n", strerror( errno )); + printf("Failed to open /dev/urandom %s\n", strerror( errno )); exit(1); } - for (int i = 0; i < size; i++) { - if( fread(buff+i,1,1,f)!=1 ) { - printf("Failed to read from /dev/random %s\n", strerror( errno )); - exit(1); - } + if( fread(buff,1,size,f)!=size ) { + printf("Failed to read from /dev/urandom %s\n", strerror( errno )); + exit(1); } fclose(f);