deterministic_random

package
v0.1.0-preview.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package deterministic_random owns the implementation details of the centralized reproducible gameplay random stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source wraps the existing x/exp/rand stream and records source consumption so snapshots can restore the exact next value.

func New

func New(seed uint64) *Source

New constructs a stream at the beginning of seed's sequence.

func Restore

func Restore(seed, calls uint64) *Source

Restore constructs a stream after the specified number of source calls.

func (*Source) Calls

func (source *Source) Calls() uint64

Calls returns the underlying source calls consumed so far.

func (*Source) Float64

func (source *Source) Float64() float64

Float64 delegates without changing the existing stream algorithm.

func (*Source) Intn

func (source *Source) Intn(n int) int

Intn delegates without changing the existing stream algorithm.

func (*Source) Reset

func (source *Source) Reset(seed uint64)

Reset returns this source to the beginning of seed's sequence while keeping the pointer stable for systems that share the centralized gameplay stream.

func (*Source) Seed

func (source *Source) Seed() uint64

Seed returns the seed used to initialize the stream.

func (*Source) Shuffle

func (source *Source) Shuffle(n int, swap func(i, j int))

Shuffle delegates without changing the existing stream algorithm.

Jump to

Keyboard shortcuts

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