Sembra un buon esempio...

Disordinare un array

Esempi in Ruby e in altri linguaggi

class Array
def randomly_pick
sort {|a, b| rand(3)-1}
end
end

x = (1..20).to_a

100.times {
print x.randomly_pick.inspect, “\n”
}

Post your comment

You can use Textile





0 comments

Readers left 0 notes on this photograph. Live yours using the form below.

Published on
25 January 2006
At
20:14
Tagged
ruby, Article