| 1143 | } |
| 1144 | |
| 1145 | static int dfhack_random_random(lua_State *L) |
| 1146 | { |
| 1147 | MersenneRNG *prng = check_random_native(L, 1); |
| 1148 | |
| 1149 | lua_settop(L, 2); |
| 1150 | if (lua_gettop(L) < 2 || lua_isnil(L, 2)) |
| 1151 | lua_pushunsigned(L, prng->random()); |
| 1152 | else |
| 1153 | lua_pushunsigned(L, prng->random(luaL_optunsigned(L, 2, 0))); |
| 1154 | return 1; |
| 1155 | } |
| 1156 | |
| 1157 | static int dfhack_random_drandom(lua_State *L) |
| 1158 | { |
nothing calls this directly
no test coverage detected