Randomly sort the /etc/passwd file, cut the first field (separated by a colon), limit the output to 10 lines, and replace the newlines with spaces.
sort -R /etc/passwd | cut -d: -f1 | MAXLINES=10 head -n $MAXLINES | tr '\n' ' '