bool Mode
In bool mode, boolean values are generated. The format of the command is as follows:
randog bool [PROP_TRUE] [--fmt FORMAT] [common-options]
Arguments and Options
PROP_TRUE
(optional, default=0.5):the probability of True.
--fmt FORMAT
(optional):the output format written in format specification mini-language
common-options
Examples
The simplest example is the following, which outputs True or False with a 50% probability of each.
randog bool
You can specify the probability of True.
# output True with 80% probability and False with 20% probability
randog bool 0.8
Format: Lowercase or Numeric
It may be necessary to output in lower case, for example, if the output is to be processed by a program in another language. In that case, the desired format can be obtained by outputting in json format as follows:
# Output True or False
randog bool
# Output true or false
randog bool --json
If you want to make it numeric, you can use --fmt
.
# Output 1 or 0
randog bool --fmt 1
Note
This takes advantage of the property that values of type bool are treated as integer values in some contexts.
Repeatedly Generate
Most likely, you will not be satisfied with just one generated, so you will probably want to output multiple times as follows:
# Repeat 10 times
randog bool -r 10
# Generate list which contains 10 values
randog bool -L 10