mirror of
https://github.com/redis/redis.git
synced 2026-04-21 03:01:35 -04:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user