Documentation
¶
Overview ¶
Package rng provides deterministic random number generation with hierarchical seed derivation.
The Derive function creates child seeds from parent seeds using FNV-1a hashing, enabling reproducible randomness across nested contexts (entity → field → row). This ensures that the same plan with the same root seed always produces identical output, which is critical for Apery's determinism guarantees.
Index ¶
- type Rng
- func (r *Rng) Float64() float64
- func (r *Rng) FloatRange(min float64, max float64) float64
- func (r *Rng) GetSeed() Seed
- func (r *Rng) IntRange(min int64, max int64) int64
- func (r *Rng) Intn(n int) int
- func (r *Rng) NewZipf(s float64, v float64, imax uint64) *rand.Zipf
- func (r *Rng) NormFloat64() float64
- func (r *Rng) Read(p []byte) (int, error)
- type Seed
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rng ¶
type Rng struct {
// contains filtered or unexported fields
}
Rng is a seeded random number generator
func (*Rng) FloatRange ¶
FloatRange returns a random float64 in [min, max]
func (*Rng) NewZipf ¶
NewZipf creates a Zipf generator with skewness s, offset v, and max value imax. s must be > 1, v must be >= 1
func (*Rng) NormFloat64 ¶
NormFloat64 returns a normally distributed float64 with mean 0 and stddev 1 using the Box-Muller transform
type Seed ¶
type Seed uint64
Seed represents a deterministic RNG seed.
func DeriveIndex ¶
DeriveIndex creates a child seed from parent + index.
func SeedFromInt64 ¶
SeedFromInt64 converts an int64 seed into a Seed.