Using Random Rule and Sampling Rule StepsLast Updated: 07/26/2016 Introduced in Verision: 2.0 |
The Random Rule and Sampling Rule components provide tests for probability in a flow. Within certain boundaries, both components will randomly return one of two outcomes “True” or “False.” This randomness can be weighted by configuring the percentage of times that the outcome will be true, on average. To guarantee the ratio of “True” to “False” outcomes, the Sampling Rule offers an additional option for configuring the sample size. The Random Rule and Sampling Rule components can be found in the Flow Designer in the Toolbox panel, under the category Data > Rules.
Example
The first probability test whether our flow will send the survey or emails is determined by the Random Rule component. It can be found in the Toolbox panel, under the heading Data > Rules.
The second probability test, whether our flow will send an email with a coupon or not, uses the Sampling Rule component. It can be found in the Toolbox panel, also under the heading Data > Rules.
Next, configure Random Rule 1 to choose the “True” outcome 50% of the time. Click on this step, and go to the Properties panel, under the section Inputs > PercentTrue.
Because PercentTrue is an input, we could dynamically determine the probability of a truthful outcome by giving it a dynamic mapping. We only need our outcome to be truthful 50% of the time, all the time, so we will give this input the Mapping type Constant and a Value of “50.”
Next, configure Sampling Rule 1. Just like Random Rule 1, Sampling Rule 1 should return a truthful outcome 50% of the time, so map its input to a Constant and a Value of “50.”
This completes our flow. It’s now ready to be saved and tested.
In our second debugger session, Random Rule 1 returned the outcome “True,” which directed our flow to Sampling Rule 1. Sampling Rule 1 returned the outcome “True,” therefore a thank you email was sent.
For the next ten times that Random Rule 1 has a truthful outcome, Sampling Rule 1 will be given the option to randomly return either a “True” or “False” outcome. By the tenth time, however, it will have chosen both outcomes exactly five times.