-- download at MT.QZX.COM (random.lua) local o = "bcd" -- outputs local i = "a" -- lever local th = 1 -- on for 1s if event.type == "on" and pin[i] then c = math.random(1, string.len(o)) mem.o = string.sub(o, c, c) port[mem.o] = true -- comment out interrupt to not use 'th', input turns it off interrupt(th, "lo") elseif event.type == "off" and not pin[i] then -- uncomment to turn off output when input turns off -- port[mem.o] = false elseif event.iid == "lo" then port[mem.o] = false end