]> ruin.nu Git - popboot.git/blobdiff - simprog.c
Changed random seed to use usec instead of seconds
[popboot.git] / simprog.c
index a71384772089c02f1217dca468fb30578a50a46a..8311d508058dd478a96b0513026f6c5155e54432 100644 (file)
--- a/simprog.c
+++ b/simprog.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
+#include <sys/time.h>
 
 void print_help(char name[])
 {
@@ -37,6 +37,7 @@ int main (int argc, char** argv)
     int i, rand_value, sum;
     int retvals[100];
     int percentages[100];
+    struct timeval td;
        
     if (argc==2 && strcmp("--help",argv[1])==0 )
     {
@@ -52,7 +53,8 @@ int main (int argc, char** argv)
 
         
     /* Get random number in interval [0,100) */
-    srand(time(0));
+    gettimeofday(&td,0);
+    srand(td.tv_usec);
     rand_value = rand() % 100;
     
     /* See if we want to fire an "error" */