function randNum() {
# Generate random number of variable length with a default of 5 digits
local val
local len=${1:-5}
for (( x=0; x<${len}; x++ )); do
val+=($(echo $((RANDOM%9))));
done
printf -- "%s" "${val[@]}"
}
# first digit can be 0 (zero)
# has a default of 5 digits if no args passed
# output should be stored to variable
# examples
some_num=$(randNum); # will output a 5 digit value and store to $some_num
other_num=$(randNum 10); # will output a 10 digit value and store to $other_num