Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created November 26, 2021 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrinterweb/cee278cd7597aa18a8dd7d5bd701f422 to your computer and use it in GitHub Desktop.
Save mrinterweb/cee278cd7597aa18a8dd7d5bd701f422 to your computer and use it in GitHub Desktop.
Script for gift name draw
require 'pp'
NAMES = %w[Frank Sean Bryn Quinn Beckett Katie Brent Brook Katelynn Adrian].freeze
pickers = NAMES.clone
available = NAMES.clone.shuffle
matches = {}
pickers.each do |picker|
picked = available.shift
if picked == picker
available << picked
picked = available.shift
end
matches[picker] = picked
end
puts 'Names:'
pp matches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment