Tools/random/choice

random/choice

Randomly pick one or more items from a list, with or without replacement.

Free / no pricing configured

What it does

Selects random items from a provided list. By default selections may repeat; set unique to sample without replacement.

Primary use cases

  • Picking a winner or a random option.
  • Drawing a random sample from a set.

Good to know

With unique true, count may not exceed the number of items. count defaults to 1. Uses a cryptographically-strong generator. Non-deterministic.

Parameters

countintegeroptional

How many items to pick. Defaults to 1.

itemsarrayrequired

The list of items to choose from.

uniquebooleanoptional

Sample without replacement (no repeats). Defaults to false.

random/choice — Faro