summaryrefslogtreecommitdiff
path: root/bishuf
blob: 62689aa9779560d753aebaa19d619e6d6c8e9a6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env zsh

SHUF=$(which shuf)
if [[ $? -ne 0 ]]; then
  SHUF=$(which gshuf)
  if [[ $? -ne 0 ]]; then
    echo "no `shuf` found, exiting"
    exit
  fi
fi


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