simulate_categorical

function simulate_categorical(ρ:Real[_]) -> Integer

Simulate a categorical distribution.

  • ρ: Category probabilities. These should sum to one.

function simulate_categorical(ρ:Real[_], Z:Real) -> Integer

Simulate a categorical distribution.

  • ρ: Unnormalized category probabilities.
  • Z: Sum of the unnormalized category probabilities.