The syntax of a bash for loop over all files in a directory is:
for i in `ls`; do <command>; done
If you want to rename all files in a directory to random names (for example to remove special characters in filenames that might be incompatible with certain software) then use this example:
for i in `ls`; do mv $i $RANDOM.jpg; done