Bernoulli sampling
In the theory of finite population sampling, Bernoulli sampling is a sampling process where each element of the population is subjected to an independent Bernoulli trial which determines whether the element becomes part of the sample. An essential property of Bernoulli sampling is that all elements of the population have equal probability of being included in the sample. Bernoulli sampling is therefore a special case of Poisson sampling. In Poisson sampling each element of the population may have a different probability of being included in the sample. In Bernoulli sampling, the probability is equal for all the elements . Because each element of the population is considered separately for the sample, the sample size is not fixed but rather follows a binomial distribution. Example. The most basic Bernoulli method generates "n" random variates to extract a sample from a population of "n" items. Suppose you want to extract a given percentage "pct" of the population. The algorithm can be described as follows: formula_2 On the left this function is shown for four values of formula_3 and formula_4. In order to compare the values for different values of formula_3, the formula_6's in abscissa are scaled from formula_7 to the  unit interval, while the value of the function, in ordinate, is multiplied by the inverse, so that the area under the graph maintains the same value —that area is related to the corresponding cumulative distribution function. The values are shown in logarithmic scale. On the right the minimum values of formula_3 that satisfy given error bounds with 95% probability. Given an error, the set of formula_6's within bounds can be described as follows: formula_10 The probability to end up within formula_11 is given again by the binomial distribution as: formula_12. The picture shows the lowest values of formula_3 such  that the sum is at least 0.95. For formula_14 and formula_15 the algorithm delivers exact results for all formula_3's. The formula_17's in between are obtained by bisection. Note that, if formula_18 is an integer percentage, formula_19, guarantees that formula_20. Values as high as formula_21 can be required for such an exact match.