I often want to perform an action on an array X times then return a result other than that number. The code I usually write is the following:
def other_participants
output =[]
NUMBER_COMPARED.times do
output << Participant.new(all_friends.shuffle.pop, self)
end
output
end
Is there a cleaner way to do this?