I recently wrote something about passwords and a comment showed up about how what I wrote wasn’t secure enough and the password should really be based on /dev/urandom instead of what amounts to microtime. While I’m not terribly concerned here, they were right so here’s an alternative:

cat /dev/urandom | base64 | head -c 12

That will return a 12 character password. Adjust the 12 to 8 if that’s what you need for length.

I pulled this technique from Stack Overflow.