---
title: Traffic Splitting and Randomization
description: >-
  Learn how Datadog Feature Flags use deterministic randomization for
  percentage-based rollouts.
breadcrumbs: Docs > Feature Flags > Concepts > Traffic Splitting and Randomization
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Traffic Splitting and Randomization

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

When you define a targeting rule, you can serve a variant to a percentage of subjects that match your targeting filter. Datadog uses **deterministic randomization** based on the `targetingKey` in your [evaluation context](https://docs.datadoghq.com/feature_flags/concepts/evaluation_context.md) so the same subject consistently receives the same variant for a given flag.

## Percentage rollouts{% #percentage-rollouts %}

In the **Targeting Rules & Rollouts** section, set the percentage of the audience that should receive each variant. For a **single-variant** targeting rule, assign your desired traffic exposure to one variant. For example, roll out the **Free Shipping** variant of your promo banner to 50% of subjects matching your filter:

{% image
   source="https://docs.dd-static.net/images/feature_flags/concepts/single-variant-traffic-exposure-2.146d586398847bfc75cc754608b08e1a.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/concepts/single-variant-traffic-exposure-2.146d586398847bfc75cc754608b08e1a.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Targeting rule with a single-variant percentage rollout." /%}

For a **multi-variant** rollout, assign percentages across multiple variants in the same targeting rule by selecting **Serve > Split Traffic** when editing or creating your targeting rule. The SDK distributes matching subjects across those variants according to the percentages you configure.

{% image
   source="https://docs.dd-static.net/images/feature_flags/concepts/multi-variant-traffic-split-2.125313751fcc337bdee1785a8f57acea.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/feature_flags/concepts/multi-variant-traffic-split-2.125313751fcc337bdee1785a8f57acea.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Targeting rule with percentages split across multiple variants." /%}

## How the SDK evaluates percentage rollouts{% #how-the-sdk-evaluates-percentage-rollouts %}

When the SDK evaluates a targeting rule with a percentage rollout, it first checks whether the evaluation context matches the rule's filter. If it matches, the SDK uses the flag key and the `targetingKey` from the evaluation context to assign the subject to a rollout bucket. That bucket determines whether the subject receives a variant from the current rule or passes through to the next rule.

Randomization is **deterministic**: a subject with the same `targetingKey` always lands in the same bucket for a given flag, so they receive the same variant on repeat evaluations. If you increase a rollout percentage later (for example, from 30% to 50%), subjects already in the treatment bucket stay there.

For multi-variant rules, the SDK applies the same bucketing logic to distribute subjects across variants according to the percentages defined on the rule.

See [Evaluation Context](https://docs.datadoghq.com/feature_flags/concepts/evaluation_context.md) for how to set the `targetingKey` in your SDK.

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Targeting Rules and Filters](https://docs.datadoghq.com/feature_flags/concepts/targeting_rules.md)
- [Evaluation Context](https://docs.datadoghq.com/feature_flags/concepts/evaluation_context.md)
