Skip to content

Instantly share code, notes, and snippets.

@therod
Last active May 1, 2018 07:05
Show Gist options
  • Save therod/918106351183e66cccc7cf27974bb7e6 to your computer and use it in GitHub Desktop.
Save therod/918106351183e66cccc7cf27974bb7e6 to your computer and use it in GitHub Desktop.
mentors = ["Hans", "Ruedi"].shuffle
attendees = ["Klara", "Kevin", "Mike", "Sandro", "Sandy", "Silvan", "Lala"].shuffle
number_of_groups = (attendees.count / mentors.count)
groups = attendees.each_slice(number_of_groups).to_a
mentors.each_with_index do |mentor, index|
puts "Group #{index + 1}: #{mentor}"
puts "===================="
puts groups.shift
puts ""
end
unless groups.empty?
puts "Leftovers"
puts "===================="
puts groups.shift
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment