Skip to content

Instantly share code, notes, and snippets.

@masayukig
Last active December 24, 2015 13:09
Show Gist options
  • Save masayukig/6802974 to your computer and use it in GitHub Desktop.
Save masayukig/6802974 to your computer and use it in GitHub Desktop.
import random
import os
l = os.environ.get("LIST").split()
for i in range(1000):
s = random.randint(0, len(l) - 1)
d = random.randint(0, len(l) - 1)
tmp = l[s]
l[s] = l[d]
l[d] = tmp
print l
@masayukig
Copy link
Author

Usage:
curl https://gist.github.com/masayukig/6802974/raw/4f4a560dea318ee6a5615399bd50de975ef05505/random_chooser.py | LIST="foo bar hoge huga" python

['foo', 'hoge', 'huga', 'bar']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment