Random Integer

Generate a random integer within an inclusive range specified by minimum and maximum values.

Code

General
echo $((min + RANDOM % (max - min + 1)))

Parameters

Minimum value (inclusive)

Maximum value (inclusive)

Server

More Bash Snippets