This commit is contained in:
Cloud Wu
2016-02-13 19:20:07 +08:00
parent 2a821fb62a
commit ea8557296b

View File

@@ -885,7 +885,12 @@ int lhmac_sha1(lua_State *L);
int
luaopen_crypt(lua_State *L) {
luaL_checkversion(L);
srandom(time(NULL));
static int init = 0;
if (!init) {
// Don't need call srandom more than once.
init = 1 ;
srandom(time(NULL));
}
luaL_Reg l[] = {
{ "hashkey", lhashkey },
{ "randomkey", lrandomkey },