ring

package
v1.4.120 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

Number is an interface representing all numerical types in Go.

type Ring

type Ring[N Number] interface {
	Put(N)                                  // Put adds a sample to the Ring.
	Min() float64                           // Min returns the smallest value of all values in the Ring.
	Max() float64                           // Max returns the largest value of all values in the Ring.
	Average() float64                       // Average computes the average value of all values in the Ring.
	MinMaxAvg() (float64, float64, float64) // MinMaxAvg computes the min, max, and average values of all values in the Ring.
	Percentile(p float32) float64           // Percentile computes a given percentile value of all values in the Ring.
}

Ring is an entity capable of keeping only the a number of most recent values.

func New

func New[N Number](window int) Ring[N]

New returns a new default implementation of the Ring interface.

Jump to

Keyboard shortcuts

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