Skip to content

Instantly share code, notes, and snippets.

@MarcAlx
Created December 9, 2025 08:59
Show Gist options
  • Select an option

  • Save MarcAlx/aea2241c5ee63b7671ccc275f47e4e9a to your computer and use it in GitHub Desktop.

Select an option

Save MarcAlx/aea2241c5ee63b7671ccc275f47e4e9a to your computer and use it in GitHub Desktop.
Secret Santa
# Simple algorithm to generate secret santa gifting, with no redundancy
import random;
# participants
ppl = ["A", "B", "C", "D", "E", "F"];
# shuffle them
random.shuffle(ppl);
# for each participant
for i in range(len(ppl)-1, -1, -1):
# print "Gifter -> Receiver", n.b when reaching 0 it will tap -1 which will loop to first one
print(ppl[i]+" -> "+ppl[i-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment