Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/ruby
class Randomizer
def initialize(teams, amount)
@teams = teams
@amount = amount
end
def get
t = 0
groups_amount = @teams.size / @amount
groups = ["A", "B", "C", "D", "E", "F", "G", "H"]
while t < groups_amount do
t += 1
group = @teams.shuffle.first(@amount)
group.each do |team|
@teams.delete(team)
end
puts "---------------"
puts "Group #{groups[t-1]}:"
puts "---------------"
puts group
end
end
end
teams = ["FAIL", "Valhalla", "BadBoys", "RP Clan", "Flying Circus", "Fallen Angels", "BACON", "NuB", "DeVils", "n0x"]
randomizer = Randomizer.new(teams, 5)
randomizer.get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment