[Paper Review] Streaming Algorithms for Optimal Generation of Random Bits
This paper presents a streaming algorithm for generating optimal random bit streams from biased coins, using a bounded-state status tree to dynamically produce unbiased bits in real time. The method achieves asymptotically optimal information efficiency—approaching the entropy limit—while maintaining linear expected time and constant space, and extends to m-sided dice and Markov chains with unknown transition probabilities.
Generating random bits from a source of biased coins (the biased is unknown) is a classical question that was originally studied by von Neumann. There are a number of known algorithms that have asymptotically optimal information efficiency, namely, the expected number of generated random bits per input bit is asymptotically close to the entropy of the source. However, only the original von Neumann algorithm has a `streaming property' - it operates on a single input bit at a time and it generates random bits when possible, alas, it does not have an optimal information efficiency. The main contribution of this paper is an algorithm that generates random bit streams from biased coins, uses bounded space and runs in expected linear time. As the size of the allotted space increases, the algorithm approaches the information-theoretic upper bound on efficiency. In addition, we discuss how to extend this algorithm to generate random bit streams from m-sided dice or correlated sources such as Markov chains.
Motivation & Objective
- Develop a streaming algorithm that generates unbiased random bits from a source of biased coins in real time, without waiting for the full input sequence.
- Achieve asymptotically optimal information efficiency—approaching the entropy of the source—while maintaining bounded memory and linear expected time.
- Extend the algorithm to handle sources with larger alphabets (e.g., m-sided dice) and correlated sources such as Markov chains with unknown transition probabilities.
- Preserve the streaming property (dynamic output generation) while improving upon von Neumann’s original algorithm, which is efficient but not information-theoretically optimal.
- Demonstrate that the algorithm’s efficiency converges to the information-theoretic upper bound as the state space (tree depth) increases.
Proposed method
- Represent the algorithm’s internal state as a binary status tree, where each node is labeled with symbols from {φ, H, T, 0, 1}, enabling dynamic state transitions based on incoming coin tosses.
- Process each incoming bit by updating the status tree according to predefined rules that track useful information for future random bit generation, avoiding loss of entropy.
- Generate random bits only when a complete pair (HT or TH) is detected in the current state, analogous to von Neumann’s method but generalized to higher-order states.
- Use a pending buffer to store the most recent exit of each state in a Markov chain, delaying input to the generalized random-stream algorithm until a second exit is observed for the same state.
- Apply the generalized random-stream algorithm independently to each state’s exit stream, then interleave the generated bits in the order of their natural generation to form a single output stream.
- Limit the depth of the status tree to control space usage, showing that efficiency rapidly approaches the entropy bound as depth increases.
Experimental results
Research questions
- RQ1Can a streaming algorithm be designed to generate unbiased random bits from biased coins with both bounded memory and asymptotically optimal information efficiency?
- RQ2How can von Neumann’s streaming approach be generalized to achieve information-theoretic optimality without requiring batch processing?
- RQ3What is the trade-off between memory size (tree depth) and information efficiency in streaming random bit generation?
- RQ4Can the algorithm be extended to generate random bit streams from m-sided dice or Markov chains with unknown transition probabilities while preserving optimality?
- RQ5Is it possible to maintain the streaming property—dynamic, real-time output—while achieving the theoretical upper bound on efficiency for correlated sources?
Key findings
- The proposed random-stream algorithm generates a stream of independent and unbiased random bits from a biased coin source, satisfying the streaming property: output is a prefix of the full output for any input prefix.
- The algorithm achieves asymptotically optimal information efficiency: the expected number of input bits per generated random bit converges to 1/H(p) as the number of output bits increases, where H(p) is the entropy of the biased coin.
- By increasing the depth of the status tree, the algorithm’s efficiency rapidly approaches the information-theoretic upper bound, with space usage remaining bounded.
- The algorithm runs in expected linear time and uses only bounded space, making it practical for real-time systems.
- The method generalizes to m-sided dice, where the information efficiency remains asymptotically optimal, and to Markov chains with unknown transition probabilities.
- For Markov chains, the algorithm processes exit sequences of each state independently, buffers pending exits, and combines outputs in generation order to produce a single stream of unbiased bits with optimal efficiency.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.