nextBeta
Draw from Beta(alpha, beta) via the two-gamma quotient X / (X + Y) where X ~ Gamma(alpha), Y ~ Gamma(beta). Fast paths for the trivial special cases:
alpha == 1.0 && beta == 1.0: returnsnextDouble()(Uniform).alpha == 1.0: returns1 - U^(1/beta)(power distribution).beta == 1.0: returnsU^(1/alpha).
nextGamma
Draw from Gamma(alpha, 1) (unit rate). Marsaglia-Tsang (2000) for alpha >= 1 with Stuart's power-of-uniform boost for alpha < 1. Two fast paths for common parameter values:
alpha == 1.0: returns-ln(U)directly (Exponential). Bypasses the Gaussian rejection loop entirely.alphaa small positive integer (2..5): sumsalphaExponential samples. Cheaper than one Gaussian + acceptance test at that scale, and the integer check pays for itself in the common Poisson-prior usage pattern.
nextLogNormal
nextNormal
Float overload of nextNormal; widens to Double, samples, narrows back.
Draw from N(mean, std^2) via Marsaglia & Tsang's Ziggurat algorithm. The fast path is one nextInt() + table lookup + comparison; ~97% of draws complete there. The slow path handles the tail beyond R = 3.4426 and the "wedge" regions outside each layer's inner rectangle.
Stateless beyond the Random receiver. The precomputed layer tables (ZIGGURAT_KN, ZIGGURAT_WN, ZIGGURAT_FN) initialise once at class load, so call sites that need many Gaussians can loop on the extension directly.
Reference: Marsaglia, G. & Tsang, W. W. (2000), "The Ziggurat Method for Generating Random Variables", Journal of Statistical Software, 5(8).
nextPoissonOne
Knuth's Poisson sampler at lambda=1; returns 0/1/2/... with mass e^{-1} / k!.