probs

package
v2.10.18 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPercentProb

func GetPercentProb(rate int) bool

Types

type WgItem

type WgItem struct {
	Element interface{}
	Weight  int
}

type WgItems

type WgItems []WgItem

func (WgItems) Len

func (w WgItems) Len() int

func (WgItems) Less

func (w WgItems) Less(i, j int) bool

func (WgItems) Swap

func (w WgItems) Swap(i, j int)

type WgRand

type WgRand struct {
	RandItems   WgItems
	TotalWeight int
	// contains filtered or unexported fields
}

func NewWgRand

func NewWgRand(choicePop bool, arguments ...int) WgRand

func (*WgRand) AddElement

func (wrc *WgRand) AddElement(element interface{}, weight int)

func (*WgRand) AddElements

func (wrc *WgRand) AddElements(elements map[interface{}]int)

func (*WgRand) GetRandomChoice

func (wrc *WgRand) GetRandomChoice() (interface{}, error)

Jump to

Keyboard shortcuts

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