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.
This commit is contained in:
gourav 2020-12-12 17:27:35 -08:00 committed by GitHub
parent feba7cbf4d
commit ddd43b6bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);