Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircularBuffer ¶
CircularBuffer is a simple circular buffer to hold recent values.
func NewCircularBuffer ¶
func NewCircularBuffer(size int) *CircularBuffer
NewCircularBuffer creates a new CircularBuffer of the given size.
func (*CircularBuffer) Add ¶
func (cb *CircularBuffer) Add(value int)
Add adds a new value to the circular buffer and updates the average.
func (*CircularBuffer) Average ¶
func (cb *CircularBuffer) Average() int
Average returns the average of the values in the circular buffer.
Click to show internal directories.
Click to hide internal directories.