crrand

package
v0.0.0-...-f2c3c5e Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package crrand implements functionality related to pseudorandom number generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Perm64

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

A Perm64 provides a deterministic, pseudorandom permutation of 64-bit values.

func MakePerm64

func MakePerm64(seed uint64) Perm64

MakePerm64 constructs a new Perm64 from a 64-bit seed, providing a deterministic, pseudorandom, bijective mapping of 64-bit values X to 64-bit values Y.

func (Perm64) At

func (p Perm64) At(n uint64) uint64

At returns the nth value in the permutation of the 64-bit values. The return value may be passed to Index to recover n. The permutation is pseudorandom.

func (Perm64) IndexOf

func (p Perm64) IndexOf(y uint64) uint64

IndexOf inverts the permutation, returning the index of the provided value in the permutation. If y was produced by At(x), then IndexOf(y) returns x.

Jump to

Keyboard shortcuts

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