Skip to main content

choose

choose(
@choices ## list (required)
@n 1
@weights null
) -> anything

Choose randomly one or more elements from a list, with optional probability weights.


Arguments

  • @choices [list]: List to choose from. (required)
  • @n [int]: Number of random choices. (default: 1).
  • @weights [list/null]: Optional probability weights for each element. (default: null).

Output

Chosen elements [anything]