sampler

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source interface {
	// Uint64 returns a random number in [0, MaxUint64] and advances the
	// generator's state.
	Uint64() uint64
}

type Uniform

type Uniform interface {
	Initialize(sampleRange uint64)
	// Sample returns length numbers in the range [0,sampleRange). If there
	// aren't enough numbers in the range, false is returned. If length is
	// negative the implementation may panic.
	Sample(length int) ([]uint64, bool)

	Next() (uint64, bool)
	Reset()
}

Uniform samples values without replacement in the provided range

func NewDeterministicUniform

func NewDeterministicUniform(source Source) Uniform

NewDeterministicUniform returns a new sampler

func NewUniform

func NewUniform() Uniform

NewUniform returns a new sampler

Jump to

Keyboard shortcuts

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