Documentation
¶
Overview ¶
Package xoroshiro implements the xoroshiro128+ RNG
This is a literal translation of http://xoroshiro.di.unimi.it/xoroshiro128plus.c and http://xoroshiro.di.unimi.it/splitmix64.c
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitMix64 ¶
type SplitMix64 uint64
SplitMix64 is an RNG with 64-bits of state
func (*SplitMix64) Next ¶
func (x *SplitMix64) Next() uint64
Next returns the next number in the sequence
type State ¶
type State [2]uint64
State is a xoroshiro128+ RNG state.
Example ¶
// If you have 128 bits of randomness for a seed, use those.
// If you have a single 64-bit seed, generate more with SplitMix64.
seed := SplitMix64(0x0ddc0ffeebadf00d)
s := State([2]uint64{seed.Next(), seed.Next()})
for i := 0; i < 10; i++ {
fmt.Println(s.Next())
}
Output: 11814330020949985800 11817088786836023749 1654166990350674155 14112748191344281834 4288295283113472773 8391955421631067594 168274855724945977 2815117763357611551 12187186948608395331 10629044371437376348