sample

abstract fun sample(random: Random): Int(source)

Draws a single random integer value from this distribution.

Return

a random integer drawn from this distribution.

Parameters

random

the source of randomness.


open fun sample(n: Int, random: Random): IntArray(source)

Draws n independent random integer values from this distribution.

Each element in the returned array is drawn independently using sample. Subclasses may override this method to provide batch-optimized sampling.

Return

an IntArray of n independent random draws.

Parameters

n

the number of values to draw. Must be non-negative.

random

the source of randomness.

Throws