MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setseed

Function setseed

lib/lua/src/lmathlib.c:609–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607
608
609static void setseed (lua_State *L, Rand64 *state,
610 lua_Unsigned n1, lua_Unsigned n2) {
611 int i;
612 state[0] = Int2I(n1);
613 state[1] = Int2I(0xff); /* avoid a zero state */
614 state[2] = Int2I(n2);
615 state[3] = Int2I(0);
616 for (i = 0; i < 16; i++)
617 nextrand(state); /* discard initial values to "spread" seed */
618 lua_pushinteger(L, n1);
619 lua_pushinteger(L, n2);
620}
621
622
623/*

Callers 2

randseedFunction · 0.85
math_randomseedFunction · 0.85

Calls 3

Int2IFunction · 0.85
nextrandFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected