3 ms·
When we did secret Santa a few years back I wrote a little python script similar to the below: import random l = ['Alice', 'Bob', 'Benny', 'Dolores']
by jbarberu 6y ago
When we did secret Santa a few years back I wrote a little python script similar to the below:
import random
l = ['Alice', 'Bob', 'Benny', 'Dolores']
random.shuffle(l)
r = dict(zip(l, (l[(i + 1) % len(l)] for i in range(0, len(l)))))
print(r)
Basically just shuffle the list, assign everybody the one next on the list (with wrap around).
- antihero 6y agoThis is exactly what I did when I wrote an assassins game for a project at uni. Gets interesting when you try and branch out and have many-many targets/assassins.