Here is how to generate a random number in a bash shell script. In the bash shell we have environmental variable $RANDOM that can generate a unique random number each time it is referenced.
echo $RANDOM
And to assign this value to a variable :
var=$RANDOM