Set the initial seed for random() (#5679)

This commit is contained in:
RemRain 2020-08-13 04:15:58 +08:00 committed by GitHub
parent 2530dc0ebd
commit 47637bea6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5135,6 +5135,7 @@ int main(int argc, char **argv) {
tzset(); /* Populates 'timezone' global. */
zmalloc_set_oom_handler(redisOutOfMemoryHandler);
srand(time(NULL)^getpid());
srandom(time(NULL)^getpid());
gettimeofday(&tv,NULL);
crc64_init();