diff --git a/rand/rng.go b/rand/rng.go index 17cee105f..5de0f9bd1 100644 --- a/rand/rng.go +++ b/rand/rng.go @@ -58,6 +58,17 @@ func (pcg *PCGSource) Uint64() uint64 { return bits.RotateLeft64(pcg.high^pcg.low, -int(pcg.high>>58)) } +// Seed128 sets both the high and low bits of the generator state to the provided values. +func (pcg *PCGSource) Seed128(high, low uint64) { + pcg.high = high + pcg.low = low +} + +// State returns the high and low bits of the generator state. +func (pcg *PCGSource) State() (high, low uint64) { + return pcg.high, pcg.low +} + func (pcg *PCGSource) add() { var carry uint64 pcg.low, carry = bits.Add64(pcg.low, incLow, 0)