Method: CommonLib::Array#swap_indexes

Defined in:
lib/common_lib/ruby/array.rb

#swap_indexes(i, j) ⇒ Object

Return a copy of the array with values at the given indexes swapped.



62
63
64
65
66
# File 'lib/common_lib/ruby/array.rb', line 62

def swap_indexes(i,j)
	new_array = self.dup
	new_array[i],new_array[j] = self[j],self[i]
	new_array
end