jot and shuf

Sounds like the name of a hipster microbrewary. Welcome to Jot and Shuff; we don't have a menu and our floors haven't been swept in a week, but we have terrible music. Enjoy!

There are dozens of ways to generate random numbers on *nix systems, for cryptograpic or other uses. Sometimes, you just want a simple integer between a certain range for use in a script.

The BSDs have long had the jot command, which can be employed for this task. For example, to return a random integer between 5 and 100:

% jot -r 1 5 100

The BSDs come with jot, because they're awesome. Linux users can install athena-jot.

Today though I also learned GNU shuf can be used for the same task on Linux and Solaris 11.

$ shuf -n 1 -i 5-100

For absolutely no reason whatsoever, have this string of numbers that shuf generated.

34 74 86 22 95 14 78 4