diff options
-rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -119,9 +119,14 @@ static bool server_socket_callback(int fd){ } #ifndef __APPLE__ -#include <sys/time.h> void srandomdev(void){ - srandom(time(NULL)); + FILE *f=fopen("/dev/urandom","r"); + assert(f); + unsigned int seed; + size_t nread=fread(&seed,1,sizeof(seed),f); + assert(nread==sizeof(seed)); + fclose(f); + srandom(seed); } #endif |