MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / math_randomseed

Function math_randomseed

third-party/lua-5.5.0/src/lmathlib.c:631–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

629
630
631static int math_randomseed (lua_State *L) {
632 RanState *state = (RanState *)lua_touserdata(L, lua_upvalueindex(1));
633 lua_Unsigned n1, n2;
634 if (lua_isnone(L, 1)) {
635 n1 = luaL_makeseed(L); /* "random" seed */
636 n2 = I2UInt(nextrand(state->s)); /* in case seed is not that random... */
637 }
638 else {
639 n1 = l_castS2U(luaL_checkinteger(L, 1));
640 n2 = l_castS2U(luaL_optinteger(L, 2, 0));
641 }
642 setseed(L, state->s, n1, n2);
643 return 2; /* return seeds */
644}
645
646
647static const luaL_Reg randfuncs[] = {

Callers

nothing calls this directly

Calls 8

lua_upvalueindexFunction · 0.85
luaL_makeseedFunction · 0.85
lua_touserdataFunction · 0.70
I2UIntFunction · 0.70
nextrandFunction · 0.70
luaL_checkintegerFunction · 0.70
luaL_optintegerFunction · 0.70
setseedFunction · 0.70

Tested by

no test coverage detected