Random number generator for shell scripts

The rather obscure shuf command can be used to generate a reasonably random number (if, for example, you want to add a random sleep delay in a shell script).

It probably should not be used if you want to generate a properly random number (such as for encryption keys).

shuf -i 1-300 -n 1

# -i specifies the number range
# -n specified the number of lines to output

[Original source: CodePoets]