RANDOM variable
Shell has an environment variable RANDOM, the range is 0-32767.
Xiaohan practical camp
- We want to generate a number in the range of 0-25
[root@hya ~]# echo $(($RANDOM%26))
20
- Get a number in the range of 1--68:
[root@hya ~]# echo $(($RANDOM%68+1))
47
- Get a number in the range of 6-87:
[root@hya ~]# echo $(($RANDOM%68+6))
23