This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
shuffle() { | |
local i tmp size max rand | |
# $RANDOM % (i+1) is biased because of the limited range of $RANDOM | |
# Compensate by using a range which is a multiple of the array size. | |
size=${#array[*]} | |
max=$(( 32768 / size * size )) |