On the Average Runtime of an Open Source Binomial Random Variate Generation Algorithm (2403.11018v1)
Abstract: The BTPE algorithm (Binomial, Triangle, Parallelogram, Exponential) of Kachitvichyanukul and Schmeiser is one of the faster and more widely utilized algorithms for generating binomial random variates. Cicirello's open source Java library, $\rho\mu$, includes an implementation of BTPE as well as a variety of other random number related utilities. In this report, I explore the average case runtime of the BTPE algorithm when generating random values from binomial distribution $B(n,p)$. Beginning with Kachitvichyanukul and Schmeiser's formula for the expected number of acceptance-rejection sampling iterations, I analyze the limit behavior as $n$ approaches infinity, and show that the average runtime of BTPE converges to a constant. I instrument the open source Java implementation from the $\rho\mu$ library to experimentally validate the analysis.
- J. H. Ahrens and U. Dieter. Computer methods for sampling from gamma, beta, poisson and bionomial distributions. Computing, 12(3):223–246, 1974. 10.1007/BF02293108.
- Multi-level features fusion and selection for human gait recognition: an optimized framework of bayesian model and binomial distribution. International Journal of Machine Learning and Cybernetics, 10(12):3601–3618, 2019. 10.1007/s13042-019-00947-0.
- Vincent A. Cicirello. JavaPermutationTools: A java library of permutation distance metrics. Journal of Open Source Software, 3(31):950, November 2018. 10.21105/joss.00950.
- Vincent A. Cicirello. Chips-n-salsa: A java library of customizable, hybridizable, iterative, parallel, stochastic, and self-adaptive local search algorithms. Journal of Open Source Software, 5(52):2448, August 2020. 10.21105/joss.02448.
- Vincent A. Cicirello. ρμ𝜌𝜇\rho\muitalic_ρ italic_μ: A java library of randomization enhancements and other math utilities. Journal of Open Source Software, 7(76):4663, August 2022. 10.21105/joss.04663.
- Vincent A. Cicirello. An analysis of an open source binomial random variate generation algorithm. Engineering Proceedings, 56(1):86, October 2023. 10.3390/ASEC2023-15349.
- Introduction to Algorithms. MIT Press, Cambridge, MA, 4th edition, 2022.
- Bernard D. Flury. Acceptance–rejection sampling made easy. SIAM Review, 32(3):474–476, 1990. 10.1137/1032082.
- The binomial distribution: Historical origin and evolution of its problem situations. Mathematics, 10(15):2680, 2022. 10.3390/math10152680.
- Binomial random variate generation. Communications of the ACM, 31(2):216–222, 1988. 10.1145/42372.42381.
- Algorithm 678: Btpec: Sampling from the binomial distribution. ACM Transactions on Mathematical Software, 15(4):394–397, 1989. 10.1145/76909.76916.
- Regression to the mean for the bivariate binomial distribution. Statistics in Medicine, 38(13):2391–2412, 2019. 10.1002/sim.8115.
- Donald E. Knuth. The Art of Computer Programming, Volume 2, Seminumerical Algorithms. Addison Wesley, 3rd edition, 1998.
- Michael E. Kuhl. History of random variate generation. In Proceedings of the 2017 Winter Simulation Conference, pages 231–242. IEEE Press, 2017. 10.1109/WSC.2017.8247791.
- Estimating risk ratios and risk differences using regression. American Journal of Epidemiology, 189(6):508–510, 2020. 10.1093/aje/kwaa044.
- Daniel A. Relles. A simple algorithm for generating binomial random variables when n is large. Journal of the American Statistical Association, 67(339):612–613, 1972. 10.1080/01621459.1972.10481259.
- Mitigating tcp syn flooding based edos attack in cloud computing environment using binomial distribution in sdn. Computer Communications, 182:198–211, 2022. 10.1016/j.comcom.2021.11.008.
- An improved binomial distribution-based trust management algorithm for remote patient monitoring in wbans. Sustainability, 14(4):2141, 2022. 10.3390/su14042141.
- Guy Steele. Jep 356: Enhanced pseudo-random number generators. JEP 356, OpenJDK, 2017. URL https://openjdk.org/jeps/356.
- Fast splittable pseudorandom number generators. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, pages 453–472, New York, NY, USA, 2014. Association for Computing Machinery. 10.1145/2660193.2660195.
- Macro risk: A versatile and universal strategy for measuring the overall safety of hazardous industrial installations in china. International Journal of Environmental Research and Public Health, 16(10):1680, 2019. 10.3390/ijerph16101680.
- Hormesis-induced gap between the guidelines and reality in ecological risk assessment. Chemosphere, 243:125348, 2020. 10.1016/j.chemosphere.2019.125348.