Code: Select all
echo $RANDOM
Code: Select all
echo $RANDOM
And, from 0 to any other number (5 in this case), like this:Pizzasgood wrote:You can also do this from the shell, to get a number from 0 - 32767:http://tldp.org/LDP/abs/html/randomvar.htmlCode: Select all
echo $RANDOM
Code: Select all
echo $[$RANDOM%6]
Code: Select all
perl -le 'print rand(6);'