add random for seed

This commit is contained in:
Cloud Wu
2018-05-07 11:10:45 +08:00
parent e561896966
commit 5f8e5f9be5

View File

@@ -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 },