random6
Random lines from a file or random numbers
Usage
random [-elrUuw]
[-f
filename]
[denominator]
Overview
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
-eoption is specified,randomdoes 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
-foption 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.
Releases
30 releases since FreeBSD 2.0.5-RELEASE; the text changed 13 times.
-U since FreeBSD 11.0-RELEASE;
-f since FreeBSD 11.0-RELEASE;
-l since FreeBSD 11.0-RELEASE;
-u since FreeBSD 11.0-RELEASE;
-w since FreeBSD 11.0-RELEASE.