Random File Names for Shuffle

My DVD player doesn’t have a shuffle mode, and I wanted to create an mp3 DVD on which the order of files is randomized. This can be done by adding a random number to the beginning of the file name. There are all kinds of tools for Windows machines. On OS X, you don’t need them (you don’t need them on Windows either if you write a little batch file). I used the following line of code to be executed in the respective directory in Terminal. Worked like a charm. It can be optimized, I know. Prerequisite is that your folder only contains the files you want to rename. Make sure, that this is only a copy and not your originals as there is no undo function.

for i in *; do mv "$i" "$((RANDOM%10000+32767))_$i"; echo "Renaming $i as $((RANDOM%10000+32767))_$i"; done