Skip to content

Instantly share code, notes, and snippets.

@miri64
Created December 16, 2014 00:43
Show Gist options
  • Save miri64/19a4e23106d8bea0f252 to your computer and use it in GitHub Desktop.
Save miri64/19a4e23106d8bea0f252 to your computer and use it in GitHub Desktop.
Script that randomly pairs up members of the argv list (created to pair up Concept Aspects in the Fate RPG)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright ©2014 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import sys
import random
if __name__ == "__main__":
if (len(sys.argv) < 3):
print("Usage: {} name1 name2 [name3 ...]".format(argv[0]), file=sys.stderr)
a = sys.argv[1:]
random.shuffle(a)
a.append(a[0])
for i, j in enumerate(a[:-1]):
print(a[i], "=>", a[i+1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment