Fixed SYNOPSIS.

Expanded stdin/stdout definitions.
Ordered the SEE ALSO references.
Moved some chat from the BUGS section to freebsd-chat@.
Removed ``cvs log'' material from the HISTORY section.
This commit is contained in:
ru 2003-02-23 01:44:14 +00:00
parent 0fe24b2245
commit 26cbc7939f

View File

@ -40,13 +40,15 @@
.Nd random lines from a file or random numbers .Nd random lines from a file or random numbers
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl er .Op Fl elrUuw
.Op Fl f Ar filename .Op Fl f Ar filename
.Op Ar denominator .Op Ar denominator
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm Random .Nm Random
has two distinct modes of operations. The default is to read in lines has two distinct modes of operations.
from stdin and randomly write them out to stdout with a probability of The default is to read in lines
from the standard input and randomly write them out
to the standard output with a probability of
1 / 1 /
.Ar denominator . .Ar denominator .
The default The default
@ -56,7 +58,8 @@ being displayed.
.Pp .Pp
The second mode of operation is to read in a file from The second mode of operation is to read in a file from
.Ar filename .Ar filename
and randomize the contents of the file and send it back out to stdout. and randomize the contents of the file and send it back out to
standard output.
The contents can be randomized based off of newlines or based off of The contents can be randomized based off of newlines or based off of
space characters as determined by space characters as determined by
.Xr isspace 3 . .Xr isspace 3 .
@ -83,41 +86,44 @@ The
.Fl f .Fl f
option is used to specify the option is used to specify the
.Ar filename .Ar filename
to read from. stdin is used if the filename is set to "-". to read from.
Standard input is used if
.Ar filename
is set to
.Sq Fl .
.It Fl l .It Fl l
Randomize the input via newlines (the default). Randomize the input via newlines (the default).
.It Fl r .It Fl r
The The
.Fl r .Fl r
option guarantees that the output is unbuffered. option guarantees that the output is unbuffered.
.It Fl u
Tells
.Xr random 6
not to 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 from the input, but it does prevent selecting the same
token more than once.
.It Fl U .It Fl U
Tells Tells
.Xr random 6 .Xr random 6
that it is okay for it to reuse any given line or word when creating a that it is okay for it to reuse any given line or word when creating a
randomized output. randomized output.
.It Fl u
Tells
.Xr random 6
not to 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 from the input, but it does prevent selecting the same
token more than once.
.It Fl w .It Fl w
Randomize words separated by Randomize words separated by
.Xr isspace 3 .Xr isspace 3
instead of newlines. instead of newlines.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr fortune 6 , .Xr random 3 ,
.Xr random 3 .Xr fortune 6
.Sh BUGS .Sh BUGS
There is no index used when printing out tokens from the list which No index is used when printing out tokens from the list which
makes rather slow for large files (10MB+). If this were used in makes it rather slow for large files (10MB+).
performance sensitive areas, I'd do something about it. For smaller For smaller
files, however, it should still be quite fast and efficient. files, however, it should still be quite fast and efficient.
.Sh HISTORY .Sh HISTORY
Original The
.Xr random 6
game was brought in from BSD 4.4 Lite by jkh in 1994. The
functionality to randomizing lines and words was added in 2003 by functionality to randomizing lines and words was added in 2003 by
seanc. .An "Sean Chittenden" Aq seanc@FreeBSD.org .