Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Shuffle array[@].
function shuffle {
integer i j t
((i = ${#array[@]}))
while ((i > 1)); do
((j = RANDOM)) # 0 <= j < 32768
((j < 32768 % i)) && continue # no modulo bias
((j %= i)) # 0 <= j < i
((i -= 1))
((t = array[i]))
((array[i] = array[j]))
((array[j] = t))
done
}
# Test program.
set -A array 11 22 33 44 55 66 77 88 99 110
shuffle
echo "${array[@]}"