summaryrefslogtreecommitdiff
path: root/bishuf
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-12-05 21:13:10 +0100
committerPatrick Simianer <p@simianer.de>2017-12-05 21:13:10 +0100
commita6b0615d945313dd1c058eb97cc02c460853411e (patch)
tree26a28f9d08cb68a4f4798f74f4515992fcc06f3c /bishuf
parent48fc2e94f023deb0783befdf970a5ae81e585e48 (diff)
bishuf: proper fixed source of randomness
Diffstat (limited to 'bishuf')
-rwxr-xr-xbishuf11
1 files changed, 6 insertions, 5 deletions
diff --git a/bishuf b/bishuf
index e3560f6..62689aa 100755
--- a/bishuf
+++ b/bishuf
@@ -9,9 +9,10 @@ if [[ $? -ne 0 ]]; then
fi
fi
-F=$(mktemp /tmp/bishuf.XXXXXX)
-echo 42 > $F
-$SHUF --random-source=$F $1 > $1.shuf
-$SHUF --random-source=$F $2 > $2.shuf
-rm $F
+
+get_random() { seed="$1"; openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt < /dev/zero 2>/dev/null; }
+
+echo "shuffling ..."
+$SHUF --random-source=<(get_random 42) $1 > $1.shuf
+$SHUF --random-source=<(get_random 42) $2 > $2.shuf