Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("pull")
- sleep(1)
- n = 0
- sum = 0
- time = 0
- local vari = {}
- while true do
- os.pullEvent("redstone")
- y = os.clock() - time
- local time = os.clock()
- os.pullEvent("redstone")
- x = os.clock() - time
- --print("t: "..x)
- local time = os.clock()
- sum = x+sum
- n = n+1
- table.insert(vari,x)
- med = sum/n
- print("t: "..x.." med: "..med.." n: "..n)
- if n > 3 then
- if med < 0.2 then
- break
- end
- end
- end
- sum2 = 0
- n2 = table.getn(vari)
- for i=1,n2 do
- sum2 = sum2+math.pow(vari[i]-med,2)
- end
- s = math.sqrt((1/n)*sum2)
- term.clear()
- term.setCursorPos(1,1)
- print("data")
- print("t: "..x.." med: "..med.." n:"..n)
- print("s: "..s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement