If that you must generate a random AlphaNumeric string from the Linux/MacOS Command-Line, then you should use the next script:
dd if=/dev/random bs=8 rely=1 2>/dev/null | od -An -tx1 | tr -d ' tn'
This can be piped right into a variable as follows:
RANDOM_ID=$(dd if=/dev/random bs=8 rely=1 2>/dev/null | od -An -tx1 | tr -d ' tn')
The above echo $RANDOM_ID
will resemble one thing much like: 90fa3bb51922eadc