- 02 Nov 2023
- 1 Minute to read

- Print
- DarkLight

# Using Random Rule and Sampling Rule Steps

- Updated on 02 Nov 2023
- 1 Minute to read

- Print
- DarkLight

## Overview

The **Random Rule** and **Sampling Rule** components provide a way to test for probability within a Flow. Both steps randomly return one of two outcomes as True or False. The 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 via the **Sample Key** Input.

## Key Differences

The key difference between using the **Sample Rule** and a **Random Rule** is that a **Sample Rule** will evenly distribute the results around the **Sample Key** value.

For example, if the Sample Key value is 10, the Rule will travel down each path exactly 5 times for every 10 runs.

## Random Rule

The following example will utilize a Random Rule and Show Popup step that displays the outcome path.

- Create a new Flow. Navigate to Toolbox > Data > Rules.
- Add the
**Random Rule**step to the workspace and define the**Percent True**input as

This will weigh the odds that the Rule will be evaluated as True. - Add the
**Show Popup**step to both outcome paths and define the step.

For the**Subject**and**Message**inputs, input the popup step's path. - Debug the
**Flow**. A notification will appear containing the result of the**Rule**.

## Sample Rule

- With the Flow Designer > Toolbox > Data > Rules.
- Add the
**Sampling Rule**step to the workspace. - In the
**Sampling Rule**step, define the**Percent True**as**50**and**Sample Key**as**10**. - In the Outcomes header for the step, check
**Output Outcome Name**.

This defines a String labeled**OutputPathName**, - Add the
**Show Popup**step to both paths. Define the inputs to the**Show Popup**step. For the**Subject**, the Outcome Path is used.

For**Message**, use**Select From Flow**and choose**OutcomePathName**as its input. - Debug the Flow. A notification will appear highlighting the outcome path.