handle poor random() better
authortridge <>
Wed, 1 Aug 2001 02:30:50 +0000 (02:30 +0000)
committertridge <>
Wed, 1 Aug 2001 02:30:50 +0000 (02:30 +0000)
disktest.c

index bc6e06d822848a484f7433d8a3bd0dce4f0c0d9e..5e2c900ceef080806186a4c61cab371a9ccd2acb 100644 (file)
@@ -114,7 +114,7 @@ static void disk_test(char *dev)
        while (1) {
                i = ((unsigned)random()) % blocks;
 
-               if (seeds[i] == 0 || (random() & 1 == 1)) {
+               if (seeds[i] == 0 || (random() & 2)) {
                        seeds[i] = random();
                        init_buf(buf, seeds[i]);
                        write_block(fd, buf, i);
@@ -128,6 +128,7 @@ static void disk_test(char *dev)
                if (count % 500 == 0) {
                        printf("%d blocks (%d reads, %d writes)\n", 
                               count, num_reads, num_writes);
+                       srandom(random() | time(NULL));
                }
        }