summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2012-06-19 09:14:41 (GMT)
committerJan Huwald <jh@sotun.de>2012-06-19 09:14:41 (GMT)
commit743581225719056a79a378f04ebb44cea1bc3b8e (patch)
tree00cf65adbf911ac8bd8b0ea6329fa27b018e62de
initial commit (extracted from FFJ buildchain)HEADmaster
-rwxr-xr-xshuf16
1 files changed, 16 insertions, 0 deletions
diff --git a/shuf b/shuf
new file mode 100755
index 0000000..8d82d4d
--- /dev/null
+++ b/shuf
@@ -0,0 +1,16 @@
+#!/usr/bin/awk -f
+BEGIN{
+ srand() # seed by time
+ srand(seed+srand()) # allow additional external seed
+}
+{ lines[++d]=$0 }
+END{
+ while (d > 0) {
+ if (e==d) {break}
+ r = int(1 + rand() * d)
+ print lines[r]
+ lines[r] = lines[d]
+ delete lines[d]
+ --d
+ }
+}
contact: Jan Huwald // Impressum