shuffleshard

package
v0.0.0-...-4ce28c2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(items, count int, key []byte) []int

Get implements a basic shuffle shard algorithm. Given a specified number of underlying items, it hashes the provided key and uses the resulting hash to select a number of items specified by the count parameter.

For a given hash key, the same shard of items will always be selected.

For two different hash keys and appropriate values of items and count, a fully overlapping set of items is unlikely. The probability of a full collision between any two keys is roughly 1/(items choose count).

Types

This section is empty.

Jump to

Keyboard shortcuts

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