• Select a random item from an array, weighted by each item's probWeight property. Items with higher weights are proportionally more likely to be selected.

    Type Parameters

    Parameters

    • items: T[]

      Candidate items, each carrying a probWeight modifier.

    • rng: Rng = ...

      The random source; defaults to the shared sohl.random singleton. Inject a seeded sohl.entity.random.createRng instance to make selection reproducible (or force it deterministically end to end).

    Returns T

    The randomly selected item.

    If the array is empty or all weights are zero.