Module bucketing

Source

Constants§

BUCKET_COUNT

Functions§

assign_bucket
Deterministic bucket assignment: sha256("{subscriber_id}:{seed}"), first 4 bytes read big-endian, mod BUCKET_COUNT. Must match the TS implementation byte-for-byte (same hash input, same byte order, same modulo) — this is the cross-language bucketing contract, verified against packages/shared/src/experiments/bucketing-vectors.json below.
select_variant_index
Weights are fractions summing to 1. Boundary must replicate JS Math.round (half-away-from-zero for positives = f64::round here).