How randomization works in Amplitude Experiment

  • Updated

This article will help you:

  • Understand the process Amplitude Experiment uses to randomly assign users to experiment variants

Amplitude Experiment uses deterministic randomization of variations. This randomization uses the Amplitude ID that Experiment assigns to each user (based on their device ID and user ID), as well as the bucketing salt of the flag.

This randomization model is two-dimensional: Amplitude Experiment performs a murmur3 hash of "bucketingSalt/amplitude_id" , and uses that hash to determine first, whether a specific user should be assigned a variant, and second, which variant that user should be assigned.

For the first stage (i.e., initial assignment), Experiment divides users into 100 buckets based on the value of mod(murmur3_x86_32("bucketingSalt/id", 100). If the bucket returned is less than the percentage rollout, then the user is bucketed into the experiment, in which case the user will be assigned a variant. If the user is not bucketed into the experiment, they will see the fallback variant instead.

For the second stage (variation assignment), Experiment will take all users bucketed into the experiment and assign each a variant according to the value of floor(murmur3_x86_32("bucketingSalt/id"), 100).

Variants are associated with values between 0 and 42949672, based on their weights. For example, in a two-variant experiment, if Variant A has weight 1 and Variant B has weight 1 (i.e., each variant should receive 50 percent of the experiment’s traffic), a user would be assigned to Variant A if the value of the hash lies between 0 and 21474835. The user would be assigned to Variant B if that value lies between 21474836 and 42949672.