Generate random permutations.
shuf [OPTION]... [FILE]
shuf -e [OPTION]... [ARG]...
shuf -i LO-HI [OPTION]...
-e, --echo Treat each ARG as an input line.
-i, --input-range=LO-HI Use the range of numbers LO (lowest) to HI (highest) as input lines.
-n, --head-count=COUNT Output only the first COUNT lines.
-o, --output=FILE Write results to a file instead of standard output.
--random-source=FILE Use the content in FILE as a random data source.
-r, --repeat Output lines may be repeated.
-z, --zero-terminated The line terminator is NUL (null character) instead of the default newline character.
--help Display help information and exit.
--version Display version information and exit.
FILE (optional): The file to be processed, which can be any number.
ARG (optional): String as input line, can be any number.
Returning 0 indicates success, returning a non-zero value indicates failure.
# Simulate a coin toss and get the first 10 results:
[user2@pc ~]$ shuf -r -n 10 -e "front" -e "reverse"
reverse side
front
front
front
reverse side
reverse side
reverse side
front
front
front
[user2@pc ~]$ shuf -i 1-35 -n 5|sort -n && shuf -i 1-12 -n 2|sort -n
4
17
20
29
31
6
11