GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
RANDOM(6) FreeBSD Games Manual RANDOM(6)

random
random lines from a file or random numbers

random [-elrUuw] [-f filename] [denominator]

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:

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.
filename
The -f option is used to specify the filename to read from. Standard input is used if filename is ‘-’.
Randomize the input via newlines (the default).
Do not buffer output.
Reuse any given line or word when creating a randomized output.
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.
Randomize words separated by isspace(3) instead of newlines.

fortune(6)

The functionality to randomizing lines and words was added in 2003 by Sean Chittenden <seanc@FreeBSD.org>.

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 rather slow for large files (10MB+).

February 15, 2020 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 6 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.