Interface WeightedElement<Type>

A structure for specifying weights of different values when selecting elements in an uneven distribution. The greater the weight, the more likely the element will be chosen.

interface WeightedElement<Type> {
    value: Type;
    weight: number;
}

Type Parameters

  • Type

Properties

Properties

value: Type

The value returned if this element is selected.

weight: number

The weight associated with this element. The greater the weight, the more likely the element will be selected.