You will have to do some bookkeeping:
2 possibilities:
- Remove a used char from the a_letters array
- Keep track of printed characters and run the random until you hit an unused one.
I would go for option 1:
n=1
a_letters=("a" "b" "c" "d" "e")
while [ $n -le 3 ]; do
uniqueLetters=($(printf '%s\n' "${a_letters[@]}"))
rand=$[ ( $RANDOM % ${#a_letters[@]})]
echo "${uniqueLetters[$rand]}"
a_letters=( "${a_letters[@]/${uniqueLetters[$rand]}}" )
n=$(( $n+1 ))
done
(untested).
What it does is remove the selected character from your array a_letters
and use the array size in the random so that it automatically corrects for the reduced array size.