Advanced Bash-Scripting Guide Chaper 9.3 . $RANDOM: ランダムな整数を生成します
特定の数値より大きい乱数を生成する方法を示します。
FLOOR=200
number=0 #initialize
while [ "$number" -le $FLOOR ]
do
number=$RANDOM
done
echo "Random number greater than $FLOOR --- $number"
echo
そして、コメントには次のように書かれています。
# Let's examine a simple alternative to the above loop, namely
# let "number = $RANDOM + $FLOOR"
# That would eliminate the while-loop and run faster.
# But, there might be a problem with that. What is it?
私はそれがまだランダムで より大きいと思う$FLOOR
ので、何が問題なのかわかりません。