summaryrefslogtreecommitdiff
path: root/src/redis-benchmark.c
diff options
context:
space:
mode:
authorgourav <gourav.bit@gmail.com>2020-12-12 17:27:35 -0800
committerGitHub <noreply@github.com>2020-12-12 17:27:35 -0800
commitddd43b6bc3ea8560bae1b0eead730235ffe7eafd (patch)
treeb59b9f8662c2a7a28f184f51e74280d5bb1dc214 /src/redis-benchmark.c
parentfeba7cbf4d75f7822f34bd67a56b2ef4a755eff9 (diff)
downloadredis-ddd43b6bc3ea8560bae1b0eead730235ffe7eafd.tar.gz
Randomize the random number generator's seed used in redis-benchmark (#8174)
The pid of the benchmark process is used to randomize the random number generator's seed. This ensures that when multiple benchmark processes are started at the same time to generate load on a server, they use different seeds. This will ensure randomness in the keys generated by different benchmark processes.
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r--src/redis-benchmark.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 5567c4af5..4efed4b12 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -1676,7 +1676,7 @@ int main(int argc, const char **argv) {
client c;
- srandom(time(NULL));
+ srandom(time(NULL) ^ getpid());
signal(SIGHUP, SIG_IGN);
signal(SIGPIPE, SIG_IGN);