Take the output of the command "ls -1q" and shuffle it using the command "shuf -e" one item at a time (xargs -n1) and then take the first two items from the output (head -n2).
xargs -n1 shuf -e $(ls -1q) | head -n2