rand
public shellscript v1 · immutable#! /bin/shlb=0ub=32768if [ $# -eq 1 ]; then ub="$1"elif [ $# -eq 2 ]; then lb="$1" ub="$2"elif [ $# -ne 0 ]; then echo "Usage: $0 [[lower_bound] upper_bound]" echo " to generate a random number in the range [lower_bound, upper_bound)" exit 1fi{ echo 'ibase = 16' printf 'r = ' dd bs=16 count=1 </dev/urandom 2>/dev/null | hexdump -ve '/1 "%02X"' echo echo 'ibase = A' echo "r % ($ub - $lb) + $lb"} | bc 2>/dev/null