Hack 85. How to generate random number in bash shell

Use the $RANDOM bash built-in function to generate random number between 0 – 32767 as shown below.

$ echo $RANDOM
22543

$ echo $RANDOM
25387

$ echo $RANDOM
647

Comments on this entry are closed.