uuidgen is one. My personal favorite is this snippet.
$ id=$(openssl rand 1000 | openssl sha1) && printf "%s${id:0:8}\n"