X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=random-word.c;h=d751d069ab21676fa2a89bf98e0c5f59a995dc34;hb=f1819fb0f4ce3620cbac7b399e925ed8abe66b09;hp=c75047b37e67f4d82057d84fbd3f4d5e8a630ba5;hpb=403b1001a00217af1b3d673028dddd3f1747da2e;p=cmccabe-bin diff --git a/random-word.c b/random-word.c index c75047b..d751d06 100644 --- a/random-word.c +++ b/random-word.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #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) { @@ -106,7 +109,7 @@ int main(void) fclose(fp); word = choose_random_word(dict); - printf("%s\n", word); + fputs(word, stdout); return 0; }