Skip to main content

List Random Item

Runs on: Shared (backend or chatbox overlay).

Picks one random item from a list. Each run makes one pick, and Item, Index and Rest all describe that same pick.

For lists of custom or built-in objects, a Weight field turns the pick into a raffle: a higher weight is more likely, and an item with a weight of 0 or below is never picked. Without a Weight, or with a plain list, every item is equally likely.

If the list is empty, or every weight is 0 or below, the node fires Empty instead of Item, Index and Rest.

Inputs​

NameTypeDescription
listlistThe list to pick from.

Outputs​

NameTypeDescription
item(list's item type)The picked item.
indexnumberThe picked item's index in the original list.
restlistThe list with the picked item removed. Wire it into another List Random Item to draw again without repeats.
emptylistFires instead of the above when the list is empty or nothing has a positive weight. Carries the original list.

Configuration​

  • Weight: Object lists and number fields only. None picks uniformly.

Example​

For a !raffle command with entries shaped { username, tickets }, set Weight to tickets so chatters with more tickets are more likely to win, and send item.username to chat.

To pick 3 distinct winners, wire rest into a second List Random Item, and that one's rest into a third. If you don't need weighting, List Shuffle into List Take is simpler.