New function 'luaL_makeseed'

This function unifies code from 'lua_newstate', 'math.randomseed',
and 'table.sort' that tries to create a value with a minimum level
of randomness.
This commit is contained in:
Roberto Ierusalimschy
2023-03-20 16:13:17 -03:00
parent 8c064fdc23
commit 5a04f1851e
9 changed files with 87 additions and 86 deletions

View File

@@ -102,7 +102,8 @@ LUA_API void *debug_realloc (void *ud, void *block,
size_t osize, size_t nsize);
#if defined(lua_c)
#define luaL_newstate() lua_newstate(debug_realloc, &l_memcontrol)
#define luaL_newstate() \
lua_newstate(debug_realloc, &l_memcontrol, luaL_makeseed(NULL))
#define luai_openlibs(L) \
{ luaL_openlibs(L); \
luaL_requiref(L, "T", luaB_opentests, 1); \