mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
add random for seed
This commit is contained in:
@@ -961,7 +961,7 @@ luaopen_skynet_crypt(lua_State *L) {
|
|||||||
if (!init) {
|
if (!init) {
|
||||||
// Don't need call srandom more than once.
|
// Don't need call srandom more than once.
|
||||||
init = 1 ;
|
init = 1 ;
|
||||||
srandom((time(NULL) << 16) ^ getpid());
|
srandom((random() << 8) ^ (time(NULL) << 16) ^ getpid());
|
||||||
}
|
}
|
||||||
luaL_Reg l[] = {
|
luaL_Reg l[] = {
|
||||||
{ "hashkey", lhashkey },
|
{ "hashkey", lhashkey },
|
||||||
|
|||||||
Reference in New Issue
Block a user