Pick at random
Pick a random item of a list, or a random row of a collection.
data.random picks one thing at random.
Settings
| Setting | What it does |
|---|---|
| From | A list, or a collection's rows. |
| List | For a list: items separated by commas or lines, such as {var.prizes}. |
| Collection, Where | For rows: which rows to pick from. |
| Read the row as | For rows: its columns are {row.column} unless you name it. |
| Save as | For a list: the name to keep the item under. The default is pick. |
Ways out
| Way out | Taken when |
|---|---|
Picked | Something was picked. |
Nothing to pick | The list was empty, or no row matched. |
Turn on If it fails for a red way out when picking from rows.
Example
A giveaway: pick a random row of entries where giveaway = {row.id}, then announce <@{row.user}> as the winner.
Related
- Weighted pick, to pick a path rather than a value
- Work out an equation, whose
randintpicks a number