ether #966(2007/07/16 05:43 GMT) [ Lua ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
math.randomseed(os.time()) function iota(n) local t = {} for i=1,n do table.insert(t, i) end return t end function lot(m, n) function pick(winners, rest, m) if m == 0 then return winners else local picked = table.remove(rest, math.random(#rest)) table.insert(winners, picked) return pick(winners, rest, m-1) end end return pick({}, iota(n), m) end function show_array(t) print("["..table.concat(t, " ").."]") end show_array(lot(arg[1], arg[2]))
Rating0/0=0.00-0+
[ reply ]
ether
#966()
[
Lua
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]