Documentation
¶
Overview ¶
Package xorshift1024star provides implementation for xorshift PRNG algorithm with multiplication as the non-linear transformation function.
References:
http://xoroshiro.di.unimi.it/ http://xoroshiro.di.unimi.it/xorshift1024star.c
Index ¶
- type Xorshift1024star
- func (x *Xorshift1024star) Float64() float64
- func (x *Xorshift1024star) Float64OO() float64
- func (x *Xorshift1024star) GetSeed() uint64
- func (x *Xorshift1024star) GetState() []byte
- func (x *Xorshift1024star) Reset()
- func (x *Xorshift1024star) Seed(seed uint64)
- func (x *Xorshift1024star) SetState(b []byte)
- func (x *Xorshift1024star) Uint64() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Xorshift1024star ¶
type Xorshift1024star struct {
// contains filtered or unexported fields
}
Xorshift1024star implements a Xorshift PRNG with 1024 bits of state and a maximal period of 2^1024-1. The algorithm uses multiplication as the non-linear transformation function
func New ¶
func New(seed uint64) *Xorshift1024star
New returns a new instance of the Xorshift1024star PRNG Engine. If the seed provided is 0, the engine is initialized with current time
func (*Xorshift1024star) Float64 ¶
func (x *Xorshift1024star) Float64() float64
Float64 returns a pseudo-random number in [0.0, 1.0) as a float64. Float64 advances the internal state of the engine.
func (*Xorshift1024star) Float64OO ¶
func (x *Xorshift1024star) Float64OO() float64
Float64OO returns a pseudo-random number in (0.0, 1.0) as a float64. Float6400 advances the internal state of the engine.
func (*Xorshift1024star) GetSeed ¶
func (x *Xorshift1024star) GetSeed() uint64
GetSeed returns the seed used to initialize the engine
func (*Xorshift1024star) GetState ¶
func (x *Xorshift1024star) GetState() []byte
GetState returns the internal state of the engine as []byte GetState can be used to save the state, e.g. to a file
func (*Xorshift1024star) Reset ¶
func (x *Xorshift1024star) Reset()
Reset reverts the internal state of the engine to its default state, except the seed
func (*Xorshift1024star) Seed ¶
func (x *Xorshift1024star) Seed(seed uint64)
Seed uses the provided value to initialize the engine
func (*Xorshift1024star) SetState ¶
func (x *Xorshift1024star) SetState(b []byte)
SetState sets the internal state of the engine from a []byte SetState can be used to resume from a saved state
func (*Xorshift1024star) Uint64 ¶
func (x *Xorshift1024star) Uint64() uint64
Uint64 returns a pseudo-random 64-bit value in [0, 2^64) as a uint64. Uint64 advances the internal state of the engine.