Abstract
In a recent work, Bernardini and Rinaldo generalize and attempt to improve upon Elias method to obtain unbiased random bits from a geometric distribution resulted from a Poisson process. As a response, we analyse the output rates of their method and compare with the original binary Elias method applied on a Bernoulli process resulted from the same Poisson process, which turns out to be much simpler to implement and to have a higher output rate.
Introduction
This paper is a response to a recent work by Bernardini and Rinaldo [1], which is summarized as follows: with an appropriate discretization, the interarrival time of a Poisson process is approximated by a geometric distribution on which Elias’s method can be applied to obtain independent and unbiased random bits, and their main contribution is to go further and take advantage of the geometric distribution to generalize Elias method to get a better output rate than directly applying classic Elias method.
Given a coin that turns heads (denoted H) with probability p, and thus turns tails (T) with probability q = 1 - p, the celebrated von Neumann’s trick [19] takes two coin flips; if the result is HT, then output 1; if the result is TH, then output 0; if we have HH or TT, then ignore the result and repeat the process until we get 0 or 1. The obtained bit is unbiased because Pr(HT) = Pr(TH) = pq. By applying this procedure repeatedly on a sequence of independent coin flips, taking two flips each time, we obtain a sequence of random bits which are unbiased and independent.
Generalizing and formalizing this idea [4, 12], an extracting functionfcolon {0, 1}
n
→ {0, 1} * takes as input n independent bits of bias p (called Bernoulli source of bias p) and returns a string of independent and unbiased random bits. For example, the function Ψ1colon {0, 1} 2 → {0, 1} *, defined by
where λ is an empty string, corresponds to the von Neumann’s procedure. This is the simplest non-trivial extracting function [12].
The output rate of an extracting function is the average number of output bits per one input bit. It is known to be bounded above by Shannon entropy H (p), which we also call the entropy bound. When p = 1/3, the output rate of von Neumann’s procedure is pq = 2/9 ≈ 0.22 (See, for example, exercise 5.1-3 in [17]) while the entropy bound H (1/3) ≈0.92; the discrepancy is quite large. There are extracting functions that achieve output rates arbitrarily close to the entropy bound, which we call asymptotically optimal. Such methods were proposed by Elias [4] and Peres [13], and Elias’s method is easily generalized to a source of s-sided dice, in which case, again, it is asymptotically optimal so that its output rate approaches the entropy bound H (p0, …, ps-1), where ‹p0, …, ps-1› is the probability distribution of the dice.
Let X be an s-sided dice with an unknown probability distribution. Elias’s original method takes n samples from the source X and partitions the sample space X n into equiprobable subsets, that is, subsets of permutations of inputs of given numbers of symbols, for which it outputs the maximum possible number of unbiased random bits. Bernardini and Rinaldo’s work takes advantage of the fact that the obtained samples from Poisson process make a (truncated) geometric distribution. This fact makes it possible to have a better partition of sample space than Elias’s original partition. The proposed partition congregates subsets of the original Elias partition, hence results in bigger equiprobable subsets, and thus higher output rate. Since the original Elias method is asymptotically optimal, their proposed method is also asymptotically optimal.
On the other hand, we can obtain another discrete distribution from a Poisson process; instead of sampling interarrival time and thus getting a geometric distribution, we can get a Bernoulli process by checking whether an arrival happened in each sampling interval. We can then apply classical binary Elias method, which turns out to be better than their method based on geometric distribution, because the output rate is higher and computation is, arguably, simpler.
In Sections 2 and 3, we explain the Elias method and the discretization of Poisson process. Section 4 comprises the main part of this paper, in which we explain the two method based on geometric distribution and Bernoulli process, and make arguments for the latter. To compare the output rates of the two methods, we don’t simply simulate the methods on samples as in [1], but we derive exact output rates and perform a numerical calculations of them. Also, discussions on how to make a proper comparison of output rates between two methods are given. To argue for the simplicity of the method based on the Bernoulli process, we discuss the complexity of the method based on the geometric distribution.
Elias Method
Elias Suppose that we have a s-faced dice whose probability distribution of outcomes is ‹p0, …, ps-1›. Elias method converts n die rolls into unbiased random bits. When s = 2 and n = 2, it is the same as the famous von Neumann’s trick for converting biased coin flips into unbiased random bits, and there is a rich literature on this problem of generating uniform random bits from biased randomness source [3, 18].
As a function, Elias method can be written as
The maximal size of {0, 1} l that fits into is 210 = 1024. The remaining 1680 - 1024 = 656 inputs are mapped similarly into full binary sets of sizes 29 = 512, 27 = 128, and 24 = 16. In general, these sizes are determined by the binary expansion of the size of the equiprobable set. In the above example, 1680 = 210 + 29 + 27 + 24, and the total number of output bits is 10 · 210 + 9 ·29 + 7 ·27 + 4 ·24. Note that the above description does not specify a value E n (x) but rather an image of equiprobable sets. Assume that we fixed a mapping and call it Elias function.
This method works for an arbitrary probability distribution ‹p0, …, ps-1›, and it is optimal in the output rate for a given distribution and for each input size. Elias method is asymptotically optimal.
When s = 2, an equiprobable set S(l,k) is also written as Sn,k, where n = l + k, or S
k
when n is assumed fixed, and its size can also be written as an equivalent binomial coefficient as well as the multinomial one:
Now, the total number α (u) of outputs on an equiprobable set is determined by the size u of the equiprobable set. More precisely, α (u) = ∑
i
ia
i
2
i
, where ∑
i
a
i
2
i
is the standard binary expansion of u with a
i
either 0 or 1. When a
i
= 1, since E
n
outputs i bits for each string in the equiprobable set S, and there are 2
i
strings in S, the sum of output lengths over S is i2
i
. So the sum of output lengths over S is ∑
i
a
i
· i · 2
i
= α (|S|). The average output length of E
n
over the entire input set {0, 1, …, s - 1}
n
is, therefore,
Figure 1 shows a graph of α. The function α is monotone increasing. In fact, it increases somewhat faster than linear; α (u) ≥ u for u ≥ 2, and it is bounded above by u log 2u with the bound met when u is a power of 2.

A plot of the function α
In fact, the function α has a little stronger property that is used by Bernardini and Rinaldo to take advantage of their partition of larger equiprobable sets of geometric samples.
If a
i
+ b
i
is 0 or 1, that is ci+1 = 0, for all i, then a
i
+ b
i
= d
i
for all i and we have
Now, since a
k
= b
k
= 0,
By applying Proposition 2 repeatedly, we obtain
discretization The arrival time T of a Poisson process with intensity λ has the probability density function
Elias-Geometric vs. Elias-Bernoulli
bernoulli-vs-geometric As we saw above, from a Poisson process, we can obtain a Bernoulli source X and an associated source Y of a geometric distribution. Since a sample from geometric random variable can be arbitrarily large and thus the partition size can even be formidable for a practical computation, a truncation is applied to get a source Z. Although Elias method can be applied on samples of Z now, as is explained below, on which the Elias method is applied. Bernardini and Rinaldo [1] takes advantage of the geometric distribution so that a larger equiprobable partition can be obtained and thus higher output rate. We call this method Elias-geometric. On the other hand, we can consider an alternative method that apply Elias algorithm, as explained above in Section 2, directly on the Bernoulli source X, which we call Elias-Bernoulli. The main goal of ours is to compare the performance of the two methods. We will use n for the number of Bernoulli samples and m for the number of geometric samples, and they are assumed fixed.
Elias-geometric
Geometric Distribution If Y is a random variable with a geometric distribution of parameter p, the probability distribution is
Classical Elias Partition Now Z is just M-valued source of probability (2). Apply Elias method to get unbiased bitstrings: Take m samples z1, z2, …, z
m
, each from Z. Then, z = (z1, z2, …, z
m
) ∈ [M]
m
= {0, 1, …, M - 1}
m
. Partition the input space [M]
m
into equiprobable sets S(m0,…,mM-1), where m
i
is the number of i in z = (z1, z2, …, z
m
) and m = m0 + … + mM-1, and the output size of Elias function
New Equiprobable Partition However, the source Z is not simply an M-valued source with an arbitrary probability distribution but it has a special distribution (2). So, we can take advantage of the property and get a better partition. Let, for 0 ≤ k ≤ m (M - 1), Q
k
be the set
More generally, for given M and m, we have
Table of Q k = ⋃ S(m0,…,mM-1) that satisfy the equations (6) and (7) for M = 4 and m = 6. The second column is the size of Q k .
Elias-geometric method is a generalized Elias method that uses these new partitions,
extremal Although it is computationally impractical to implement the corresponding version of Elias algorithm, for the sake of analysis, consider an extremal case of Elias-geometric where the truncation step is removed, or rather M =∞. Now the random variable Z = Y is pure geometric, and a sample can be arbitrarily large and the input space bNm is partitioned into equiprobable subsets
and, for
The extremal case of Elias-geometric, where M =∞, has the output rate
correspondence We have an obvious one-to-one correspondence between {0, 1} ∞ and bN ∞. Say the following bitstring is from a Bernoulli process with p = 0.17:

A monotone path 0011000001101000000001 in a grid of size k × m. The last vertical segment of length one is attached to show the way we make the correspondence Ψ. There are exactly k + m - 1choosem - 1 = m + k - 1choosek such paths.
sample-size-comp A Bernoulli process of parameter p induces the geometric distribution with the average arrival time 1/p. In other words, we can expect one arrival in 1/p-th discretization interval on average. So every 1/p samplings of Bernoulli process amounts to a single sample of the corresponding geometric source. In fact, the entropy of the geometric distribution is
Now consider sampling from the Bernoulli process. The appropriate size must be, by the above discussion, n = m/p, where m is the sample size for Elias-geometric. (Or m = np. We have one geometric sample for every 1 in the source Bernoulli samples.)
Expected length of the inverse. Another way, or a more convincing way to see this is to consider the average length of Ψ-1 (y) over all
The output rate for Elias-Bernoulli is, as in (1),

Output rates r
B
(n, p) (solid) and
Implementation of Elias-geometric
Although the larger partitions Q
k
result in higher output rate, in order to compute Elias function, as far as we know, we need to compute a rank of a given input sequence in the equiprobable partition, and part seems to be the computational bottleneck. (See [12, 14] for details.) And to do that we need to know the size of Q
k
. In the idealized case of
Exact Comparison of the Output Rates
Although we derived exact formula for the output rates r
B
(p, n) and
Footnotes
Acknowledgement
This work was supported in part by a Hongik University grant and the National Research Foundation of Korea (NRF) grant funded by the Korean government (No. 2016R1D1A1B01016531).
