math

package
v0.0.0-...-1e8d25b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max[T constraints.Ordered](a, b T) T

Max returns the maximum of two ordered arguments.

func Min

func Min[T constraints.Ordered](a, b T) T

Min returns the minimum of two ordered arguments.

Types

type EwmaRate

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

EwmaRate tracks an exponentially weighted moving average of a per-second rate.

func NewEWMARate

func NewEWMARate(alpha float64, interval time.Duration) *EwmaRate

func (*EwmaRate) Add

func (r *EwmaRate) Add(delta int64)

func (*EwmaRate) Inc

func (r *EwmaRate) Inc()

Inc counts one event.

func (*EwmaRate) Rate

func (r *EwmaRate) Rate() float64

Rate returns the per-second rate.

func (*EwmaRate) Tick

func (r *EwmaRate) Tick()

Tick assumes to be called every r.interval.

Jump to

Keyboard shortcuts

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