Skip to content

Instantly share code, notes, and snippets.

@caseywatts
Last active March 10, 2021 19:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseywatts/604ae11e4211acb0d3bc to your computer and use it in GitHub Desktop.
Save caseywatts/604ae11e4211acb0d3bc to your computer and use it in GitHub Desktop.
Random Groups of X
LISTOFNAMES = %{...}
GROUPSIZE = 5
names = LISTOFNAMES.split("\n")
shufflednames = names.shuffle
shufflednames.each_slice(GROUPSIZE).with_index do |group, i|
puts "\nGroup " + i.to_s
group.each {|name| puts name}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment