Last active
July 15, 2018 13:16
-
-
Save lhog/7c6c019e536131387cf855b032eaac92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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