test/librbd/fsx: don't use time() for seeding
authorIlya Dryomov <idryomov@gmail.com>
Wed, 19 Sep 2018 14:37:36 +0000 (16:37 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 1 Oct 2018 14:48:47 +0000 (16:48 +0200)
When starting multiple concurrent jobs with rbd_fsx task, all jobs get
the same seed.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/test/librbd/fsx.cc

index e03a6783e34ea0dfe5dc39795915f2993997ba39..dec8534f23a5080d456b8c121eefb2645da5168f 100644 (file)
@@ -19,7 +19,6 @@
 #include <unistd.h>
 #include <getopt.h>
 #include <limits.h>
-#include <time.h>
 #include <strings.h>
 #if defined(__FreeBSD__)
 #include <sys/disk.h>
@@ -3250,7 +3249,7 @@ main(int argc, char **argv)
                case 'S':
                         seed = getnum(optarg, &endp);
                        if (seed == 0)
-                               seed = time(0) % 10000;
+                               seed = std::random_device()() % 10000;
                        if (!quiet)
                                fprintf(stdout, "Seed set to %d\n", seed);
                        if (seed < 0)