Lune

PLDI2025Top-tier venue

Random Variate Generation with Formal Guarantees

Feras A. Saad, Wonyeol Lee

Abstract

WONYEOL LEE, POSTECH, Republic of Korea Generating random variates is a fundamental operation in diverse areas of computer science and is supported in almost all modern programming languages. Traditional software libraries for random variate generation are grounded in the idealized "Real-RAM" model of computation, where algorithms are assumed to be able to access uniformly distributed real numbers from the unit interval and compute with infinite-precision real arithmetic. These assumptions are unrealistic, as any software implementation of a Real-RAM algorithm on a physical computer can instead access a stream of individual random bits and computes with finite-precision arithmetic. As a result, existing libraries have few theoretical guarantees in practice. For example, the actual distribution of a random variate generator is generally unknown, intractable to quantify, and arbitrarily different from the desired distribution; causing runtime errors, unexpected behavior, and inconsistent APIs.

This article introduces a new approach to principled and practical random variate generation with formal guarantees. The key idea is to first specify the desired probability distribution in terms of a finite-precision numerical program that defines its cumulative distribution function (CDF), and then generate exact random variates according to this CDF. We present a universal and fully automated method to synthesize exact random variate generators given any numerical CDF implemented in any binary number format, such as floating-point, fixed-point, and posits. The method is guaranteed to operate with the same precision used to specify the CDF, does not overflow, avoids expensive arbitrary-precision arithmetic, and exposes a consistent API. The method rests on a novel space-time optimal implementation for the class of generators that attain the information-theoretically optimal Knuth and Yao entropy rate, consuming the least possible number of input random bits per output variate. We develop a random variate generation library using our method in C and evaluate it on a diverse set of "continuous" and "discrete" distributions, showing competitive runtime with the state-of-the-art GNU Scientific Library while delivering higher accuracy, entropy efficiency, and automation.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Bit Blasting Probabilistic Programs cites SPPL: probabilistic programming with fast exact symbolic inference
  • Efficient Online Random Sampling via Randomness Recycling cites The Discrete Gaussian for Differential Privacy
  • One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes cites High performance correctly rounded math libraries for 32-bit floating point representations
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. Efficient Online Random Sampling via Randomness RecyclingThomas L. Draper, Feras A. SaadSODA 2026

Builds on8

  1. The Discrete Gaussian for Differential PrivacyClément L. Canonne, Gautam Kamath, Thomas SteinkeNeurIPS 2020 · 355 citations
  2. SPPL: probabilistic programming with fast exact symbolic inferenceFeras A. Saad, Martin C. Rinard, Vikash K. MansinghkaPLDI 2021 · 38 citations
  3. High performance correctly rounded math libraries for 32-bit floating point representationsJay P. Lim, Santosh NagarakattePLDI 2021 · 19 citations
  4. One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modesJay P. Lim, Santosh NagarakattePOPL 2022 · 15 citations
  5. Bit Blasting Probabilistic ProgramsPoorva Garg, Steven Holtzen, Guy Van den Broeck, Todd D. MillsteinPLDI 2024 · 10 citations

Related papers

  1. Optimal approximate sampling from discrete probability distributionsFeras A. Saad, Cameron E. Freer, Martin C. Rinard, Vikash K. MansinghkaPOPL 2020 · 3 citations
  2. Energy-Efficient Random Variate Generation via Compressed Lookup TablesJohann Ukrow, Anna Kazachkova, Nicolas Alder, Sven Köhler et al.ICLR 2026
  3. Semantics of Integrating and Differentiating SingularitiesJesse Michel, Wonyeol Lee, Hongseok YangPLDI 2025
  4. Verifying Exact Samplers for Continuous Distributions with a Discrete Program LogicMarkus de Medeiros, Puming Liu, Kwing Hei Li, Alejandro Aguirre et al.LICS 2026
  5. Symbolic execution for randomized programsZachary Susag, Sumit Lahiri, Justin Hsu, Subhajit RoyOOPSLA 2022 · 17 citations
Dusk over the sea between two cliffs drawn in fine vertical lines