Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test random skill id
--lua 5.3 print ("Hello, World!") local t = {[1000]=0,[1001]=10,[1002]=20,[1003]=80} -- 计算总概率区间 local total = 0 for i, v in pairs(t) do total = total + v end -- 计算技能id local skillId = 0 local cur = 0; local val = math.random(0,total) for i, v in pairs(t) do cur = cur +v if val <= cur then skillId = i break end end print ("random val: "..val, "skillId:"..skillId)
run
|
edit
|
history
|
help
0
test
Replace all substring in string
Hand positions in a circle
ok
PAID HACK PuBG
Simple Lua primality test
PAID HACK PuBG
Visala Test
Monty Hall Problem Simulated
Non-Lua core for new scripting languages (Beta)