Online Random Sampling with Real Probabilities
arXiv:2607.13828
The paper presents an online algorithm that samples from a sequence of discrete distributions using only fair coin flips, achieving near‑optimal entropy usage while using only logarithmic space.
Abstract
We develop an efficient online algorithm to sample a sequence of discrete random variables using an entropy source of i.i.d. fair coin flips, in a standard model of real computation where real-valued probabilities are represented by rational approximations. For any sequence of probability distributions, our sampler generates outputs using at most coin flips in expectation while carrying bits of persistent space, where is the Shannon entropy. Under standard assumptions, we prove that the space used by our sampler to achieve this information-theoretically optimal entropy rate is asymptotically optimal. The key idea is to replace the global arithmetic-decoding sampling scheme of Han and Hoshi (1997) with a local discrete uniform state, yielding an exponential reduction in space for a given entropy loss. Our approach applies to distributions with irrational probabilities and countably infinite supports, generalizing recent randomness-recycling methods beyond finite rational distributions with bounded denominator.