Maybe something like this:
Code:
function randTest127653()
local sumTest = 0
while sumTest < 100 do
local rand = math.random(1, 10)
if sumTest + rand > 100 then
rand = 100 - sumTest
end
sumTest = sumTest + rand
print('sumTest: '..sumTest..' rand: '..rand)
end
end
First: while -> if number is lower than 100
Second: rand numer from range 1-10
Third: Check if rand numer + sum is lower than 100 -> If don't -> calculate matching numer
Fourth: Add "rand" numer with "sum" variable
Fifth: Print loop result step (you must change this, create table and add value "rand" to this table in this line. After line 10 add "return table_name")