The following shell script plays avi, mpeg and wmv files in a random order when executed in a directory containing files.
#!/bin/bash ls -1Q \ | awk 'BEGIN {FS="\n"} /.*.(avi|mpg|mpeg|wmv)/ {printf("%i\t%s\n",rand()*10^6,$1) }' \ | sort | cut -f2 | xargs mplayer -fs