discretedist

package
v0.0.0-...-796008b Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2016 License: AGPL-3.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

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