From 26cbc7939fffbb8d1673ce63ece81de7ded0a8b4 Mon Sep 17 00:00:00 2001 From: ru Date: Sun, 23 Feb 2003 01:44:14 +0000 Subject: 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. --- games/random/random.6 | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'games/random') diff --git a/games/random/random.6 b/games/random/random.6 index 9706d74..9854b81 100644 --- a/games/random/random.6 +++ b/games/random/random.6 @@ -40,13 +40,15 @@ .Nd random lines from a file or random numbers .Sh SYNOPSIS .Nm -.Op Fl er +.Op Fl elrUuw .Op Fl f Ar filename .Op Ar denominator .Sh DESCRIPTION .Nm Random -has two distinct modes of operations. The default is to read in lines -from stdin and randomly write them out to stdout with a probability of +has two distinct modes of operations. +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 / .Ar denominator . The default @@ -56,7 +58,8 @@ being displayed. .Pp The second mode of operation is to read in a file from .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 space characters as determined by .Xr isspace 3 . @@ -83,41 +86,44 @@ The .Fl f option is used to specify the .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 Randomize the input via newlines (the default). .It Fl r The .Fl r option guarantees that the output is unbuffered. +.It Fl U +Tells +.Xr random 6 +that it is okay for it to reuse any given line or word when creating a +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 +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 -Tells -.Xr random 6 -that it is okay for it to reuse any given line or word when creating a -randomized output. .It Fl w Randomize words separated by .Xr isspace 3 instead of newlines. .El .Sh SEE ALSO -.Xr fortune 6 , -.Xr random 3 +.Xr random 3 , +.Xr fortune 6 .Sh BUGS -There is no index used when printing out tokens from the list which -makes rather slow for large files (10MB+). If this were used in -performance sensitive areas, I'd do something about it. For smaller +No index is used when printing out tokens from the list which +makes it rather slow for large files (10MB+). +For smaller files, however, it should still be quite fast and efficient. .Sh HISTORY -Original -.Xr random 6 -game was brought in from BSD 4.4 Lite by jkh in 1994. The +The functionality to randomizing lines and words was added in 2003 by -seanc. +.An "Sean Chittenden" Aq seanc@FreeBSD.org . -- cgit v1.1