Code was obtained from VGAM package function VGAM::rbetabinom.ab. The VGAM
package is available under the GPL-3 license and maintained by
Thomas Yee <t.yee at auckland.ac.nz>. Source code of the function is identical
to rbetabinom.ab, but the function name was changed to beta_binom.