Add the musictube script
[cmccabe-bin] / random-word.c
index b55bd1d..d751d06 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
+#include <sys/time.h>
 
 #define DICT "/usr/share/dict/linux.words"
 #define STARTING_SZ 8192
@@ -91,7 +91,10 @@ int main(void)
        FILE *fp;
        const char *word;
        struct dict *dict;
-       srandom(time(NULL));
+       struct timeval tv;
+
+       gettimeofday(&tv, NULL);
+       srandom(tv.tv_usec * tv.tv_sec);
 
        fp = fopen(DICT, "r");
        if (! fp) {