Reprinted from: http://blog.163.com/qingfeng_0105@126/blog/static/75062738201101711244243/Thanks
to the blogger for sharing!
The shell environment variable RANDOM, the value range is 0–32767
If we want to generate numbers in the range 0-25, we can use this environment variable to modulo 26: $ (($RANDOM%26))
exist Symbolic: $ (( $ RANDOM%26)) == $((RANDOM%26))
[root@localhost ~]# echo $(($RANDOM%26))
19
[root@localhost ~]# echo $((RANDOM%26))
22
practical application
If you want to get numbers in the range 1–68: $ (($RANDOM%68+1 ))
[root@localhost ~]# echo $(($RANDOM%68+1))
67
If you want to get numbers in the range 6–87: $ (($RANDOM%82+6 ))
[root@localhost ~]# echo $((RANDOM%80+6))
8