Note that
$RANDOM range is [0, 32767] (not enough for five digits), and Bash does not have any support for floating-point arithmetic. You'll need to use fixed-point arithmetic or string manipulation, if you really want to do this with Bash.
A random number [0.00000, 1.00000):
Code:
v=$[(100 + (RANDOM % 100)]$[1000 + (RANDOM % 1000)]
v=0.${v:1:2}${v:4:3}
echo $v
Or, [0.00000, 15.00000):
Code:
v=$[100 + (RANDOM % 100)]$[1000 + (RANDOM % 1000)]
v=$[RANDOM % 15].${v:1:2}${v:4:3}
echo $v
Rather than Bash, I'd use e.g.
awk for floating-point calculation and simple data manipulation:
Code:
awk 'BEGIN { printf("%.5f\n", rand() * 15.0) }'
although awk's rand() needs a seed via srand(), e.g.
Code:
awk -v "seed=$[(RANDOM & 32767) + 32768 * (RANDOM & 32767)]" \
'BEGIN { srand(seed); printf("%.5f\n", rand() * 15.0) }'