| 615 | |
| 616 | |
| 617 | static int math_randomseed (lua_State *L) { |
| 618 | RanState *state = (RanState *)lua_touserdata(L, lua_upvalueindex(1)); |
| 619 | if (lua_isnone(L, 1)) { |
| 620 | randseed(L, state); |
| 621 | } |
| 622 | else { |
| 623 | lua_Integer n1 = luaL_checkinteger(L, 1); |
| 624 | lua_Integer n2 = luaL_optinteger(L, 2, 0); |
| 625 | setseed(L, state->s, n1, n2); |
| 626 | } |
| 627 | return 2; /* return seeds */ |
| 628 | } |
| 629 | |
| 630 | |
| 631 | static const luaL_Reg randfuncs[] = { |
nothing calls this directly
no test coverage detected