Versions in this module Expand all Collapse all v1 v1.0.0 Mar 31, 2024 Changes in this version + var ErrNoValidOptions = errors.New("0 Option(s) with Weight >= 1") + var ErrWeightOverflow = errors.New("sum of Option weights exceeds total") + type Option struct + Data DataType + Weight WeightIntegerType + func NewOption[DataType any, WeightIntegerType WeightIntegerConstraint](data DataType, weight WeightIntegerType) Option[DataType, WeightIntegerType] + type SearchIntsFuncSignature func(runningTotalWeights []int, randInt int) int + type Selector struct + func NewSelectorUsingSortSearchInts[DataType any, WeightIntegerType WeightIntegerConstraint](options ...Option[DataType, WeightIntegerType]) (*Selector[DataType, WeightIntegerType], error) + func NewSelectorWithCustomSearchIntsFunc[DataType any, WeightIntegerType WeightIntegerConstraint](searchIntsFunc SearchIntsFuncSignature, ...) (*Selector[DataType, WeightIntegerType], error) + func NewSelector[DataType any, WeightIntegerType WeightIntegerConstraint](options ...Option[DataType, WeightIntegerType]) (*Selector[DataType, WeightIntegerType], error) + func (s Selector[DataType, WeightIntegerType]) Select() DataType + type WeightIntegerConstraint interface Other modules containing this package github.com/eljamo/weightedoption/v2