bytesource

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

Jump to

Keyboard shortcuts

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