Random true value with specified probability
one_in num (number)
Returns true or false with a specified probability - it will return true every one in num times where num is the param you specify
Introduced in v2.0
Examples
| # Example 1 |
|
one_in 2
|
# will return true with a probability of 1/2, false with probability 1/2
|
| # Example 2 |
|
one_in 3
|
# will return true with a probability of 1/3, false with a probability of 2/3
|
| # Example 3 |
|
one_in 100
|
# will return true with a probability of 1/100, false with a probability of 99/100
|