To generate random numbers in Bash use the RANDOM environment variable. One can also set the limits to get random numbers within a defined range. For example, to generate a random integer within the range of 1 to 100, use the following code:
echo $((RANDOM % 100 + 1)