FreeBSD manual
download PDF document: random.6.pdf
RANDOM(6) FreeBSD Games Manual RANDOM(6)
NAME
random - random lines from a file or random numbers
SYNOPSIS
random [-elrUuw] [-f filename] [denominator]
DESCRIPTION
Random has two distinct modes of operations. The default is to read
lines from standard input and write them to standard output with a
probability of 1.0 / denominator. (denominator is a real number greater
than or equal to 1.0.) The default denominator for this mode of
operation is 2.0, giving each line a 50% chance of being displayed.
The second mode of operation, selected with the -f filename option, reads
the specified file and outputs the randomized contents to standard
output. The contents can be randomized in units of lines (split on
newline characters) or in units of words (split on space characters as
determined by isspace(3).) The default denominator for this mode of
operation is 1.0, which displays every line.
The options are as follows:
-e If the -e option is specified, random does not read or write
anything, and simply exits with a random exit value of 0 to
denominator - 1, inclusive. In this mode, denominator must be
less than or equal to 256.
-f filename
The -f option is used to specify the filename to read from.
Standard input is used if filename is `-'.
-l Randomize the input via newlines (the default).
-r Do not buffer output.
-U Reuse any given line or word when creating a randomized output.
-u Do not select the same line or word from a file more than once
(the default). This does not guarantee uniqueness if there are
two of the same tokens in the input.
-w Randomize words separated by isspace(3) instead of newlines.
SEE ALSO
fortune(6)
HISTORY
The functionality to randomizing lines and words was added in 2003 by
Sean Chittenden <seanc@FreeBSD.org>.
BUGS
This tool is a remnant of the "games" collection formerly part of FreeBSD
base. It probably should have been removed to ports with the rest of
that collection. It does not have a coherent purpose and the motivation
for it to be a core base utility is nonobvious.
No index is used when printing out tokens from the list which makes it