Documentation
¶
Overview ¶
Package xoshiro256p implements xoshiro256+ 1.0, our best and fastest generator for floating-point numbers. We suggest to use its upper bits for floating-point generation, as it is slightly faster than xoshiro256++/xoshiro256**. It passes all tests we are aware of except for the lowest three bits, which might fail linearity tests (and just those), so if low linear complexity is not considered an issue (as it is usually the case) it can be used to generate 64-bit outputs, too.
We suggest to use a sign test to extract a random Boolean value, and right shifts to extract subsets of bits.
The state must be seeded so that it is not everywhere zero. If you have a 64-bit seed, we suggest to seed a splitmix64 generator and use its output to fill s.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is a random source using xoshiro256+ algorithm.
Go port of http://prng.di.unimi.it/xoshiro256plus.c
Example ¶
package main
import (
"fmt"
"math/rand"
"github.com/shogo82148/randsrc/xoshiro256p"
)
func main() {
src := xoshiro256p.New([4]uint64{1})
r := rand.New(src)
for i := 0; i < 10; i++ {
fmt.Println(r.Int63())
}
}
Output: 0 0 17592186044416 35184405643264 2305860601466912832 4613942216287584384 2310373010047057984 5188151177417629712 3750945450325278752 5193818615473770640