sample

open override fun sample(random: Random): Int(source)

Draws a single random integer from this beta-binomial distribution using compound sampling.

First draws a random success probability from Beta(alpha, beta), then draws a count of successes from Binomial(trials, p). This two-stage process faithfully reproduces the beta-binomial distribution.

Return

a random number of successes drawn from this distribution, in [0, trials].

Parameters

random

the source of randomness.