Another way to randomize filenames

This post describes an easier way to randomize filenames using the command openssl compared to my previous post named Randomize filenames.

#!/bin/bash
for filename in *.JPG
do
mv "$filename" $(echo "$filename" | openssl rand -hex 3).JPG
done

After running this script the filenames can look something like this

26333c.JPG
a8c7a0.JPG
b16b22.JPG
d69a67.JPG
...

The rand option creates a random value from $filename.