Files
RPG_City_Maker_Reborn/seed.go
T
2026-02-05 17:50:55 -06:00

23 lines
604 B
Go

package main
import "math/rand"
// SeedProvider is a simple struct that provides a stream of random seeds
// from a single initial seed. This ensures that the entire map generation
// process is deterministic if the same initial seed is used.
type SeedProvider struct {
rand *rand.Rand
}
// NewSeedProvider creates a new SeedProvider with the given initial seed.
func NewSeedProvider(seed int64) *SeedProvider {
return &SeedProvider{
rand: rand.New(rand.NewSource(seed)),
}
}
// Next returns the next random seed in the sequence.
func (sp *SeedProvider) Next() int64 {
return sp.rand.Int63()
}