Function smartnoise_runtime::utilities::noise::censored_specific_geom[][src]

pub fn censored_specific_geom(enforce_constant_time: bool) -> Result<i16>

Return sample from a censored Geometric distribution with parameter p=0.5 without calling to sample_bit_prob.

The algorithm generates 1023 bits uniformly at random and returns the index of the first bit with value 1. If all 1023 bits are 0, then the algorithm acts as if the last bit was a 1 and returns 1022.

This is a less general version of the sample_geometric_censored function, designed to be used only inside of the sample_bit_prob function. The major difference is that this function does not call sample_bit_prob itself (whereas sample_geometric_censored does), so having this more specialized version allows us to avoid an infinite dependence loop.