Documentation ¶
Overview ¶
Package xoshiro256 implements the xoshiro256** random number generator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source struct {
S [4]uint64 // Generator state (256 bits).
}
A Source is a xoshiro256** 1.0 random number generator.
The zero Source is not usable; it produces a stream of zeros.
Note that Sources constructed by New or initialized with Seed can produce 2^64 distinct streams of random numbers. The state S is public for applications that need more.
func New ¶
New returns a Source initialized with the given seed. It is equivalent to allocating a Source and calling Seed on it.
func (*Source) MarshalBinary ¶
MarshalBinary encodes s in a binary format for serialization.
The format starts with a 16-byte header, followed by the four 64-bit integers of state in little-endian format.
The returned error is always nil.
func (*Source) Seed ¶
Seed uses the provided seed value to initialize the generator to a deterministic state. The seed value may be any 64-bit integer.
It uses a SplitMix64 generator to turn seed into four non-zero pseudo-random numbers.
func (*Source) UnmarshalBinary ¶
UnmarshalBinary decodes s from the binary format used by MarshalBinary.