public
Description: personal scripts
Homepage:
Clone URL: git://github.com/mackstann/bin.git
bin / randsort
100755 18 lines (11 sloc) 0.366 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
 
# Written by Nick Welch <nick@incise.org>. Author disclaims copyright.
 
# like the sort(1) command, but sorts in a random order. no attempt made at
# high performance.
 
import sys, random
 
try:
    lines = sys.stdin.readlines()
 
    while lines:
        sys.stdout.write(lines.pop(random.randint(0, len(lines)-1)))
except IOError:
    pass