| draw_categorical | R Documentation |
Given a uniform random draw and a vector of probabilities, returns the 1-based integer index of the selected category.
draw_categorical(luck, probs)
luck |
Numeric between 0 and 1 (inclusive). A uniform random draw. |
probs |
Numeric vector of probabilities. Will be normalized to sum to 1 internally. All values must be >= 0. |
Integer: 1-based index of the selected category.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.