PWADDlocal function XRNT_Sim_Impl() local seed = P_RandomFixed() print("Seed: " .. seed) local state = XRNG.Sim_Create(seed) print("Sim_GetFixed: "..XRNG.Sim_GetFixed(state)) print("Sim_GetByte: "..XRNG.Sim_GetByte(state)) print("Sim_GetSigned: "..XRNG.Sim_GetSigned(state)) print("Sim_GetInt32: "..XRNG.Sim_GetInt32(state)) print("Sim_GetKey(999): "..XRNG.Sim_GetKey(state,999)) print("Sim_GetZeroToLimit(-999): "..XRNG.Sim_GetZeroToLimit(state,-999)) print("Sim_GetApproxNormal: "..XRNG.Sim_GetApproxNormal(state)) local shuf_tester = {1,2,3,4} XRNG.Sim_Shuffle(state, shuf_tester) print("Sim_Shuffle({1,2,3,4}): "..table.concat(shuf_tester, ',')) print("Sim_GetRange(-61,-99): "..XRNG.Sim_GetRange(state,-61,99)) XRNG.Sim_Destroy(state) end local function XRNT_Sim() if not XRNG then print "You need to load XRNG first!" end print("Testing XRNG.Sim...") local results = {pcall(XRNT_Sim_Impl)} if results[1] then print("No errors!") else print("Error: "..results[2]) end end COM_AddCommand("xrng_test_sim", XRNT_Sim) 8LUA_XRNT