mathx

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcEntropy

func CalcEntropy(m map[interface{}]int) float64

CalcEntropy calculates the entropy of m.

func MaxInt

func MaxInt(a, b int) int

MaxInt returns the larger one of a and b.

func MinInt

func MinInt(a, b int) int

MinInt returns the smaller one of a and b.

Types

type Proba

type Proba struct {
	// contains filtered or unexported fields
}

A Proba is used to test if true on given probability.

func NewProba

func NewProba() *Proba

NewProba returns a Proba.

func (*Proba) TrueOnProba

func (p *Proba) TrueOnProba(proba float64) (truth bool)

TrueOnProba checks if true on given probability.

type Unstable

type Unstable struct {
	// contains filtered or unexported fields
}

A Unstable is used to generate random value around the mean value base on given deviation.

func NewUnstable

func NewUnstable(deviation float64) Unstable

NewUnstable returns a Unstable.

func (Unstable) AroundDuration

func (u Unstable) AroundDuration(base time.Duration) time.Duration

AroundDuration returns a random duration with given base and deviation.

func (Unstable) AroundInt

func (u Unstable) AroundInt(base int64) int64

AroundInt returns a randome int64 with given base and deviation.

Jump to

Keyboard shortcuts

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