abtestify
Deterministic A/B test bucketing for Rust. Give it an experiment name and a user ID and it returns the same variant for that user every time, with no storage, no network calls and no dependencies.
Assignments are byte-for-byte identical to the abtestify npm package and its Go, Python, Java/Kotlin and Swift ports, so a user lands in the same variant on every platform. Shared test vectors in the repository enforce it.
[]
= "0.3"
use ;
let params = new
.treatment_split // optional, default 50
.exposure; // optional, default 100
match get_bucket
Params also takes treatment_variant_name, control_variant_name,
ignore_variant_name and legacy_hashing. get_bucket returns an Error
when a percentage is not a finite number from 0 to 100 or a required name is
empty.
The bucket is the first 8 bytes of SHA-256 of experiment_name:unique_id,
mapped to one of 10,000 buckets. Exposure takes the lowest buckets, and the
split uses the bucket's last two digits, so raising exposure only adds users
and raising treatment_split only moves users from control to treatment.
Licensed under MIT.