# POSIX sh with /dev/random available
randname() {
  dd bs=6 count=1 if=/dev/random 2>/dev/null | od -tx1 -An | tr -d ' '
}

# replace tempdir assignment in the previous example.
while [ "${i}" -lt 10 ]; do
  tempdir=${TMPDIR:-/tmp}/$(randname)-$$
done
