Documentation ¶
Overview ¶
Package sample includes the functionality for sampling from a discrete distribution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscreteDistribution ¶
type DiscreteDistribution struct {
WeightedValues []WeightedValue
}
DiscreteDistribution represents a collection of weighted values that form a distribution.
func (DiscreteDistribution) Random ¶
func (d DiscreteDistribution) Random() interface{}
Random samples the DiscreteDistribution and returns the resulting value.
type WeightedValue ¶
type WeightedValue struct { Value interface{} Frequency uint }
WeightedValue represents the value and its frequency.
Click to show internal directories.
Click to hide internal directories.