English

Algorithms for Generating Small Random Samples

Data Structures and Algorithms 2025-01-10 v3 Discrete Mathematics Probability

Abstract

We present algorithms for generating small random samples without replacement. We consider two cases. We present an algorithm for sampling a pair of distinct integers, and an algorithm for sampling a triple of distinct integers. The worst-case runtime of both algorithms is constant, while the worst-case runtimes of common algorithms for the general case of sampling kk elements from a set of nn increase with nn. Java implementations of both algorithms are included in the open source library ρμ\rho\mu.

Keywords

Cite

@article{arxiv.2405.12371,
  title  = {Algorithms for Generating Small Random Samples},
  author = {Vincent A. Cicirello},
  journal= {arXiv preprint arXiv:2405.12371},
  year   = {2025}
}

Comments

Various improvements based on feedback from reviewers of submission to the journal, Software: Practice and Experience