sample

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

Draws a single random value from this negative binomial distribution.

Generates successes independent geometric random variables and returns their sum, exploiting the fact that a negative binomial random variable is the sum of independent geometric random variables.

Return

a random non-negative integer representing the number of failures before the required successes.

Parameters

random

the source of randomness.