| 633 | |
| 634 | |
| 635 | static int math_randomseed (lua_State *L) { |
| 636 | RanState *state = (RanState *)lua_touserdata(L, lua_upvalueindex(1)); |
| 637 | if (lua_isnone(L, 1)) { |
| 638 | randseed(L, state); |
| 639 | } |
| 640 | else { |
| 641 | lua_Integer n1 = luaL_checkinteger(L, 1); |
| 642 | lua_Integer n2 = luaL_optinteger(L, 2, 0); |
| 643 | setseed(L, state->s, n1, n2); |
| 644 | } |
| 645 | return 2; /* return seeds */ |
| 646 | } |
| 647 | |
| 648 | |
| 649 | static const luaL_Reg randfuncs[] = { |
nothing calls this directly
no test coverage detected