alfred3.randomizer.random_condition#

alfred3.randomizer.random_condition(*conditions) str[source]#

Returns a random condition based on the supplied arguments with equal probability of all conditions.

Parameters

*conditions – A variable number of condition identifiers

Returns

One of the input arguments, chosen at random.

Return type

str

See also

This is a naive way of randomizing, suitable mostly for quick prototypes with equal probability of all conditions. A more powerful approach is offered by ListRandomizer.

Examples

>>> import alfred3 as al
>>> al.random_condition("A", "B")
A

The example returns either “A” or “B”.