12 Zeilen
276 B
Go
12 Zeilen
276 B
Go
|
package weightedrandom
|
||
|
|
||
|
// New returns an new instance of WeightRandom
|
||
|
func New[T any](af AdjustFunc, rf RandomFunc, acf AccessModifier) *WeightRandom[T] {
|
||
|
return &WeightRandom[T]{
|
||
|
data: []*weightitem[T]{},
|
||
|
weightFunc: af,
|
||
|
randomFunc: rf,
|
||
|
accessfunc: acf,
|
||
|
}
|
||
|
}
|