categorical_sample#
- statrl.settings.utils.categorical_sample(prob_n, np_random)[source]#
Draw one index from a categorical distribution.
- Parameters:
prob_n (array-like of float) – Probability vector; must sum to one.
np_random (numpy.random.Generator) – Generator supplying the uniform draw, so that a seeded environment stays reproducible.
- Returns:
The sampled index.
- Return type: