Skip to content

Instantly share code, notes, and snippets.

@lhog
Last active Jul 15, 2018
Embed
What would you like to do?
--Inputs
LEVELS = 20
x= 0.15
--Vars
rest = 1.0
sum = 0
array = {}
table.insert(array, 0.0)
for i = 1, LEVELS - 1 do
sum = sum + rest * x
table.insert(array, sum)
rest = rest * (1.0-x)
end
mul = 1 / array[#array]
str = ""
for i = 1, LEVELS do
if i < LEVELS then
str = str .. (array[i] * mul) ..", "
else
str = str .. (array[i] * mul)
end
end
print(str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment