From ea25e20c88b6bfdc739f00774c500cf4abd55d6f Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 7 May 2018 10:55:18 +0800 Subject: [PATCH] more random seed --- lualib-src/lua-crypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lualib-src/lua-crypt.c b/lualib-src/lua-crypt.c index 6959f171..e34a939a 100644 --- a/lualib-src/lua-crypt.c +++ b/lualib-src/lua-crypt.c @@ -7,6 +7,7 @@ #include #include #include +#include #define SMALL_CHUNK 256 @@ -960,7 +961,7 @@ luaopen_skynet_crypt(lua_State *L) { if (!init) { // Don't need call srandom more than once. init = 1 ; - srandom(time(NULL)); + srandom((time(NULL) << 16) ^ getpid()); } luaL_Reg l[] = { { "hashkey", lhashkey },