Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created August 28, 2014 15:23
Show Gist options
  • Save pumpkincouture/6b47f3dca27c8a4cd0be to your computer and use it in GitHub Desktop.
Save pumpkincouture/6b47f3dca27c8a4cd0be to your computer and use it in GitHub Desktop.
def shuffle_list(refined_list)
random_list = refined_list.shuffle
random_array = random_list[rand]
first_name = random_array[0]
last_name = random_array[-1]
original_first = ""
original_last = ""
swap_first = ""
swap_last = ""
refined_list.each do |array|
if array[1] == array[4]
array[3], first_name = first_name, array[3]
array[4], last_name = last_name, array[4]
original_first += first_name
original_last += last_name
swap_first += array[3]
swap_last += array[4]
elsif array[3] == swap_first
array[3] = original_first
array[4] = original_last
else
refined_list
end
end
refined_list
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment