Files

Tins::Shuffle

Public Instance Methods

shuffle() click to toggle source
# File lib/tins/shuffle.rb, line 12
def shuffle
  dup.shuffle!
end
shuffle!() click to toggle source

:nocov:

# File lib/tins/shuffle.rb, line 4
def shuffle!
  (size - 1) .downto(1) do |i|
    j = rand(i + 1)
    self[i], self[j] = self[j], self[i]
  end
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.