Created
January 23, 2018 09:13
-
-
Save Loveforkeeps/731f93073b532f540fc9b013a7dbeed8 to your computer and use it in GitHub Desktop.
生成一个指定范围内的随机数。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ $# < 2 ]];then | |
echo "please assign Minnum and Maxnums!" | |
exit 0 | |
fi | |
min=$1; | |
max=$2-$1; | |
num=$RANDOM | |
((retnum=num%max+min)) | |
echo $retnum; | |
exit $retnum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment