Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Frequency distribution of rolling a certain number on xDy
sides = 6 dice = 8 table = {} for i = 1, sides do table[i] = 1 end for i = 1, dice - 1 do temp_table = {} terms = 1 start = i while start <= sides * i do temp_table[start + terms] = 0 for j = start, math.min(sides * i, start + terms - 1) do temp_table[start + terms] = temp_table[start + terms] + table[j] end if terms < sides then terms = terms + 1 else start = start + 1 end end table = temp_table end for k = dice, dice * sides do print(k, table[k]) end
run
|
edit
|
history
|
help
0
roulette
Lua Timer
VWPASSATPOLIZEI
Root
Hakusu
Replace all substring in string
test3
ok
Key
Surface Area of things (Incomplete)