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
Beispiel2
Creating habits v2, Lua (WIP)
Security keygen
cumulative probability
Brainfuck Interpreter (Lua) [reposted]
xml panel repeater
test
String Searcher
True every 5
zzz