diff --git a/tests/zfs-tests/include/math.shlib b/tests/zfs-tests/include/math.shlib index 38d9fecea7cf..da1e77e5fb97 100644 --- a/tests/zfs-tests/include/math.shlib +++ b/tests/zfs-tests/include/math.shlib @@ -118,9 +118,7 @@ function verify_ne # # A simple function to get a random number between two bounds (inclusive) # -# Probably not the most efficient for large ranges, but it's okay. -# -# Note since we're using $RANDOM, 32767 is the largest number we +# Note since we're using $RANDOM, $min+32767 is the largest number we # can accept as the upper bound. # # $1 lower bound @@ -129,11 +127,6 @@ function random_int_between { typeset -i min=$1 typeset -i max=$2 - typeset -i rand=0 - - while [[ $rand -lt $min ]] ; do - rand=$(( $RANDOM % $max + 1)) - done - echo $rand + echo $(( (RANDOM % (max - min + 1)) + min )) }