probdist

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause Imports: 7 Imported by: 0

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

type WeightedDist struct {
	sync.Mutex
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

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