Documentation ¶
Overview ¶
Package xoshiro implements the Xoshiro512**, Xoshiro256** and SplitMix64 pseudorandom number generators described at http://xoshiro.di.unimi.it/ .
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitMix64 ¶
type SplitMix64 uint64
SplitMix64 is the mix64variant13 pseudorandom number generator using GOLDEN_GAMMA (0x9e3779b97f4a7c15) state/seed increments, as described in http://gee.cs.oswego.edu/dl/papers/oopsla14.pdf . It is used for seeding the Xoshiro256StarStar generator, but can also be used standalone. It implements rand.Source and rand.Source64. The implementation is a direct port from http://xoshiro.di.unimi.it/splitmix64.c .
func NewSplitMix64 ¶
func NewSplitMix64(seed int64) *SplitMix64
NewSplitMix64 creates a new SplitMix64 PRNG.
func (*SplitMix64) Int63 ¶
func (x *SplitMix64) Int63() int64
Int63 implements rand.Source by returning the upper bits from x.Uint64.
type Xoshiro256StarStar ¶
type Xoshiro256StarStar struct {
// contains filtered or unexported fields
}
Xoshiro256StarStar is the Xoshiro256** pseudorandom number generator described at http://xoshiro.di.unimi.it/ . It implements rand.Source and rand.Source64. The implementation is a direct port from the reference C source: http://xoshiro.di.unimi.it/xoshiro256starstar.c .
func NewXoshiro256StarStar ¶
func NewXoshiro256StarStar(seed int64) *Xoshiro256StarStar
NewXoshiro256StarStar creates a new NewXoshiro256StarStar PRNG.
func (*Xoshiro256StarStar) Int63 ¶
func (x *Xoshiro256StarStar) Int63() int64
Int63 implements rand.Source by returning the upper bits from x.Uint64.
func (*Xoshiro256StarStar) Jump ¶
func (x *Xoshiro256StarStar) Jump()
Jump is equivalent to 2^128 calls to Uint64.
func (*Xoshiro256StarStar) Seed ¶
func (x *Xoshiro256StarStar) Seed(seed int64)
Seed implements rand.Source by seeding the Xoshiro generator state using the first 4 outputs of a SplitMix64 generator seeded by seed.
func (*Xoshiro256StarStar) Uint64 ¶
func (x *Xoshiro256StarStar) Uint64() uint64
Uint64 implements rand.Source64 by returning the next Xoshiro random number.
type Xoshiro512StarStar ¶
type Xoshiro512StarStar struct {
// contains filtered or unexported fields
}
Xoshiro512StarStar is the Xoshiro512** pseudorandom number generator described at http://xoshiro.di.unimi.it/ . It implements rand.Source and rand.Source64. The implementation is a direct port from the reference C source: http://xoshiro.di.unimi.it/xoshiro512starstar.c .
func NewXoshiro512StarStar ¶
func NewXoshiro512StarStar(seed int64) *Xoshiro512StarStar
NewXoshiro512StarStar creates a new Xoshiro512StarStar PRNG.
func (*Xoshiro512StarStar) Int63 ¶
func (x *Xoshiro512StarStar) Int63() int64
Int63 implements rand.Source by returning the upper bits from x.Uint64.
func (*Xoshiro512StarStar) Jump ¶
func (x *Xoshiro512StarStar) Jump()
Jump is equivalent to 2^256 calls to Uint64.
func (*Xoshiro512StarStar) Seed ¶
func (x *Xoshiro512StarStar) Seed(seed int64)
Seed implements rand.Source by seeding the Xoshiro generator state using the first 8 outputs of a SplitMix64 generator seeded by seed.
func (*Xoshiro512StarStar) Uint64 ¶
func (x *Xoshiro512StarStar) Uint64() uint64
Uint64 implements rand.Source64 by returning the next Xoshiro random number.