Given a script 'random.sh' with the following content:
#!/bin/bash
RANDOM=`python -v -d -S -c "import random; print random.randrange(500, 800)"`
echo $RANDOM
Running this produces random numbers outside the given range:
[root@localhost nms]# ./random.sh
23031
[root@localhost nms]# ./random.sh
9276
[root@localhost nms]# ./random.sh
10996
renaming the RANDOM variable to RAND, gives me random numbers from the given range, i.e.
#!/bin/bash
RAND=`python -v -d -S -c "import random; print random.randrange(500, 800)"`
echo $RAND
gives:
[root@localhost nms]# ./random.sh
671
[root@localhost nms]# ./random.sh
683
[root@localhost nms]# ./random.sh
537
My question is -- why? :)