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
6
7
8
# type: ignore
def sample_bernoulli_exp1(x) -> bool:
    k = 1
    while True:
        if sample_bernoulli_rational(x / k, false): # |\label{line:B_i}|
            k += 1
        else: 
            return is_odd(k) # |\label{line:K}|