get weighted random

This block is part of the array group and was last modified in core v10.4.28.

get weighted random v10.4.28

Returns a random weighted item from the given array

In pins 1
  • array required
    array<object>

    Array of objects, should contain weight key.

Out pins 2
  • object
    object
  • weight
    number

Picks one object from the array with probability proportional to its weight field and outputs it on object with its weight on weight. Only object items whose weight is an actual finite number participate; numeric STRINGS are ignored. When no item qualifies the block emits NOTHING on either pin.

A typical wiring for get weighted random: the object out pin feeds custom field.

Studio canvas example for the get weighted random block: typical wiring for get weighted random.

Version history

Introduced in v10.4.28.


Back to array Return to the main group to view all sub-groups Back to array Return to the group to view all blocks within this group