Documentation ¶
Overview ¶
Package probdist implements a weighted probability distribution suitable for protocol parameterization. To allow for easy reproduction of a given distribution, the drbg package is used as the random number source.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WeightedDist ¶
WeightedDist is a weighted distribution.
func New ¶
func New(seed *drbg.Seed, min, max int, biased bool) (w *WeightedDist)
New creates a weighted distribution of values ranging from min to max based on a HashDrbg initialized with seed. Optionally, bias the weight generation to match the ScrambleSuit non-uniform distribution from obfsproxy.
func (*WeightedDist) Reset ¶
func (w *WeightedDist) Reset(seed *drbg.Seed)
Reset generates a new distribution with the same min/max based on a new seed.
func (*WeightedDist) Sample ¶
func (w *WeightedDist) Sample() int
Sample generates a random value according to the distribution.
func (*WeightedDist) String ¶
func (w *WeightedDist) String() string
String returns a dump of the distribution table.