If a seed is not provided via --seed, we use the default rand() values,
which produces the same sequence of values every run. Since this is
undesirable, we should choose a random seed via the current time().
Note that this patch moves the srand() until after all the initial
options processing.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
uint32_t offset = 0;
uint32_t length = -1;
+ seed = time(NULL);
+
for (;;) {
static const char *short_options="hkl:mo:p:s:";
static const struct option long_options[] = {
case 's':
seed = atol(optarg);
- srand(seed);
break;
case 'p':
printf("Bad blocks : %d\n", oldstats.badblocks);
printf("BBT blocks : %d\n", oldstats.bbtblocks);
+ srand(seed);
+
for (pass = 0; pass < nr_passes; pass++) {
loff_t test_ofs;