diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2003-02-23 01:44:14 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2003-02-23 01:44:14 +0000 |
commit | 2bee685c4ac36ebd7c55ec5daa4db15611d5246f (patch) | |
tree | aa4a2414f86dabdc9b6d3930b5f529ae6ba7bce2 /games | |
parent | 8b6eff89b0563fd66682adc2e3bbefc8da02a423 (diff) | |
download | src-test2-2bee685c4ac36ebd7c55ec5daa4db15611d5246f.tar.gz src-test2-2bee685c4ac36ebd7c55ec5daa4db15611d5246f.zip |
Notes
Diffstat (limited to 'games')
-rw-r--r-- | games/random/random.6 | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/games/random/random.6 b/games/random/random.6 index 9706d74d136d..9854b8131f27 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 . |