Mega Code Archive
Categories
/
Ruby
/
Collections
Randomly each
module Enumerable def each_randomly (sort_by { rand }).each { |e| yield e } end end %w{A b c }.each_randomly { |x| puts x }