random

package
v0.52.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64

func Int64[T constraints.Integer](max T) int64

Types

type WeightedChooser

type WeightedChooser struct {
	// contains filtered or unexported fields
}

func NewWeightedRandomChooser

func NewWeightedRandomChooser() *WeightedChooser

func (*WeightedChooser) Add

func (w *WeightedChooser) Add(value interface{}, weight int)

func (*WeightedChooser) GetAndRemove

func (w *WeightedChooser) GetAndRemove() (interface{}, error)

GetAndRemove choose a random entry based on their weights, and removes it from the list

func (*WeightedChooser) Remove

func (w *WeightedChooser) Remove(i int)

func (*WeightedChooser) Size

func (w *WeightedChooser) Size() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL