From 5f8e5f9be59f4516951c14a232173754e63190ad Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 7 May 2018 11:10:45 +0800 Subject: [PATCH] add random for seed --- lualib-src/lua-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lualib-src/lua-crypt.c b/lualib-src/lua-crypt.c index e34a939a..6f99d4f6 100644 --- a/lualib-src/lua-crypt.c +++ b/lualib-src/lua-crypt.c @@ -961,7 +961,7 @@ luaopen_skynet_crypt(lua_State *L) { if (!init) { // Don't need call srandom more than once. init = 1 ; - srandom((time(NULL) << 16) ^ getpid()); + srandom((random() << 8) ^ (time(NULL) << 16) ^ getpid()); } luaL_Reg l[] = { { "hashkey", lhashkey },