Skip to content

Instantly share code, notes, and snippets.

@Loveforkeeps
Created January 23, 2018 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Loveforkeeps/731f93073b532f540fc9b013a7dbeed8 to your computer and use it in GitHub Desktop.
Save Loveforkeeps/731f93073b532f540fc9b013a7dbeed8 to your computer and use it in GitHub Desktop.
生成一个指定范围内的随机数。
#!/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