Documentation ¶
Overview ¶
Package math provides mathematical utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExponentialDistribution ¶
type ExponentialDistribution float64
ExponentialDistribution represents an exponential distribution with a given mean.
func NewExponentialDistribution ¶
func NewExponentialDistribution(mean float64) ExponentialDistribution
NewExponentialDistribution creates an ExponentialDistribution with the given mean.
func (ExponentialDistribution) CumulativeProbability ¶
func (mean ExponentialDistribution) CumulativeProbability(x float64) float64
CumulativeProbability returns P(X < x) for this distribution. Based on http://mathworld.wolfram.com/ExponentialDistribution.html
func (ExponentialDistribution) InverseCumulativeProbability ¶
func (mean ExponentialDistribution) InverseCumulativeProbability(p float64) (float64, error)
InverseCumulativeProbability returns the critical point x, such that P(X < x) = p.
type PoissonDistribution ¶
type PoissonDistribution struct {
// contains filtered or unexported fields
}
PoissonDistribution models the number of times an event occurs in an interval of time. It produces a sequence of time.Duration values that represent the delay between the events for an average rate.
func NewPoissonDistribution ¶
func NewPoissonDistribution(rate float64) (*PoissonDistribution, error)
NewPoissonDistribution creates a new new PoissonDistribution with the given average rate. The rate must be greater than 0.
The PoissonDistribution created by this function contains a random number source that is not safe for concurrent use (see math/rand.NewSource).
func NewPoissonDistributionWithRand ¶
func NewPoissonDistributionWithRand(rate float64, rng *rand.Rand) (*PoissonDistribution, error)
NewPoissonDistributionWithRand creates a new PoissonDistribution with the given average rate and random number generator. The rate must be greater than 0.
func (*PoissonDistribution) Next ¶
func (p *PoissonDistribution) Next() time.Duration
Next generates the next delay in the sequence.