Skip to main content

xchoose

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

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


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]