sample

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sample provides a library of data structures/algorithms for sampling from a stream of data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reservoir

type Reservoir struct {
	Size int
	// contains filtered or unexported fields
}

Reservoir is a struct for performing reservoir sampling on a stream.

func (*Reservoir) Push

func (r *Reservoir) Push(x interface{})

Push consumes a value to perform reservoir sampling.

func (*Reservoir) Sample

func (r *Reservoir) Sample() []interface{}

Sample returns a copied slice of the obtained sample.

Jump to

Keyboard shortcuts

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