randfillsigs.k8s.io/randfill/bytesource Index | Files

package bytesource

import "sigs.k8s.io/randfill/bytesource"

Package bytesource provides a rand.Source64 that is determined by a slice of bytes.

Index

Types

type ByteSource

type ByteSource struct {
	*bytes.Reader
	// contains filtered or unexported fields
}

ByteSource implements rand.Source64 determined by a slice of bytes. The random numbers are generated from each 8 bytes in the slice, until the last bytes are consumed, from which a fallback pseudo random source is created in case more random numbers are required. It also exposes a `bytes.Reader` API, which lets callers consume the bytes directly.

func New

func New(input []byte) *ByteSource

New returns a new ByteSource from a given slice of bytes.

func (*ByteSource) Int63

func (s *ByteSource) Int63() int64

func (*ByteSource) Seed

func (s *ByteSource) Seed(seed int64)

func (*ByteSource) Uint64

func (s *ByteSource) Uint64() uint64

Source Files

bytesource.go

Version
v1.0.0 (latest)
Published
Mar 4, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
1 month ago

Tools for package owners.