pcg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package pcg provides a seedable PCG-based PRNG for tests and non-cryptographic randomness.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSeedLength = errs.New("seed length is not 8 bytes")
	ErrInvalidSaltLength = errs.New("salt length is not 8 bytes")
)

Functions

This section is empty.

Types

type Pcg

type Pcg struct {
	// contains filtered or unexported fields
}

func New

func New(seed, salt uint64) *Pcg

New creates a new PCG PRNG seeded with the given seed and salt.

func NewRandomised

func NewRandomised() *Pcg

NewRandomised creates a new PCG PRNG with random seed and salt.

func (*Pcg) New

func (*Pcg) New(seed, salt []byte) (prng.SeedablePRNG, error)

New generates a new PRNG of the same type with the provided seed and salt.

func (*Pcg) Read

func (r *Pcg) Read(p []byte) (int, error)

Read fills the provided byte slice p with random bytes.

func (*Pcg) Seed

func (r *Pcg) Seed(seed, salt []byte) error

Seed resets the internal state of the PRNG with the provided seed and salt.

Jump to

Keyboard shortcuts

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