Using Random Rule and Sampling Rule StepsLast Updated: 05/02/2018 Introduced in Version: 2.0
The Random Rule and Sampling Rule components provide a way to test for probability with in a flow. Within certain boundaries both components will randomly return one of two outcomes “True” or “False.” The random outcomes can be weighted by configuring the percentage of times that the outcome will be true. 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 Steps panel, under the category Data > Rules.
The Random Rule component determines whether our flow will send the survey or emails, which is the first probability. It can be found in the Steps panel, under the heading Data > Rules.
The Sampling Rule component test whether our flow will send an email with a coupon. It can be found in the Steps panel under the category 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. Just like Random Rule, Sampling Rule 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 returned the outcome “True,” which directed our flow to Sampling Rule. Sampling Rule returned the outcome “True,” therefore a thank you email was sent.
For the next ten times that Random Rule has a truthful outcome, Sampling Rule 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.