Hi,
As the src code in https://github.com/redis/redis/blob/unstable/src/server.c#L6941-L6943.
I have little questions for help:
- why should we depend on both of
rand(...)andradom(...), shall we just select one of them - is it necessary to call
time(...)cuz we have got the value of time in seconds viagettimeofday(...), maybe we could save the of cost of callingtime(...)
to be short, the expect as below:
gettimeofday(&tv,NULL);
srandom(tv.tv_sec^getpid()^tv.tv_usec);
or
gettimeofday(&tv,NULL);
srandom((tv.tv_sec*1000000+tv.tv_usec)^getpid());
i don't konw if it is okay.