Documentation ¶
Overview ¶
Package discretedist implements finite discrete distribution sampling suitable for protocol parameterization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscreteDist ¶
type DiscreteDist struct {
// contains filtered or unexported fields
}
DiscreteDist is a finite discrete distribution.
func NewUniform ¶
func NewUniform(r *mrand.Rand, minValue, maxValue, maxN int, biased bool) *DiscreteDist
NewUniform creates a new uniform discrete distribution, optionally with biased probabilities.
func (*DiscreteDist) Sample ¶
func (d *DiscreteDist) Sample(r *mrand.Rand) int
Sample generates a random value according to the distribution with the provided entropy source.
func (*DiscreteDist) String ¶
func (d *DiscreteDist) String() string
String returns a the probability distribution as a string, with entries p < 0.01 omitted for brevity.
Click to show internal directories.
Click to hide internal directories.