diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c index 9d23a73d0..499039a7e 100644 --- a/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c @@ -959,6 +959,8 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker) "sigprocmask() failed"); } + srandom((ngx_pid << 16) ^ ngx_time()); + /* * disable deleting previous events for the listening sockets because * in the worker processes there are no events at all at this point diff --git a/src/os/win32/ngx_win32_init.c b/src/os/win32/ngx_win32_init.c index d2505ced4..d3cc37603 100644 --- a/src/os/win32/ngx_win32_init.c +++ b/src/os/win32/ngx_win32_init.c @@ -228,7 +228,7 @@ ngx_os_init(ngx_log_t *log) ngx_sprintf((u_char *) ngx_unique, "%P%Z", ngx_pid); } - srand((unsigned) ngx_time()); + srand((ngx_pid << 16) ^ (unsigned) ngx_time()); return NGX_OK; }