opendp 0.14.2-dev.20260401.2

A library of differential privacy algorithms for the statistical analysis of sensitive private data.
1
2
3
4
5
# type: ignore
# returns a single bit with some probability of success
def sample_bernoulli_rational(prob: RBig, trials: Optional[int]) -> bool:
    numer, denom = prob.into_parts()
    return numer > UBig.sample_uniform_int_below(denom, trials)