Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
def swingers(couples)
randomized_couples = couples.shuffle
randomized_couples.each_with_index do |couple, index|
if index != randomized_couples.length - 1
randomized_couples[index][1], randomized_couples[index+1][1] = randomized_couples[index+1][1], randomized_couples[index][1]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment