test/unit: include microseconds in default random seed
This commit is contained in:
parent
4998afc9bb
commit
6b6b097fe8
1 changed files with 3 additions and 1 deletions
|
@ -37,6 +37,7 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *test_name, *s;
|
char *test_name, *s;
|
||||||
int i, seed = 0;
|
int i, seed = 0;
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
test_name = argv[0];
|
test_name = argv[0];
|
||||||
s = strrchr(test_name, '.');
|
s = strrchr(test_name, '.');
|
||||||
|
@ -57,7 +58,8 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srandom(seed ? seed : time(NULL));
|
gettimeofday(&tv, NULL);
|
||||||
|
srandom(seed ? seed : tv.tv_sec ^ (tv.tv_usec << 10));
|
||||||
|
|
||||||
printf("Testing %-30s ", test_name);
|
printf("Testing %-30s ", test_name);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
Loading…
Reference in a new issue