Documentation ¶
Overview ¶
Package xorshift implements a simple library for pseudo random number generators based on xorshift*, xorshift+, xoroshiro+, xoroshiro** and splitmix64.
Xorshift* generators are obtained by scrambling the output of a Marsaglia xorshift generator with a 64-bit invertible multiplier. Xorshift+ generators are a 64-bit version of Saito and Matsumoto's XSadd generator. Xoroshiro+ (XOR/rotate/shift/rotate) is the successor to xorshift+. The scrambler simply adds two words of the state array. Xoroshiro** (XOR/rotate/shift/rotate) in this case the scrambler is given by a multiply-rotate-multiply sequence applied to a chosen word of the state array. Splitmix64 generator is a fixed-increment version of Java 8's SplittableRandom generator.
It's based on the work of Sebastiano Vigna (http://xoroshiro.di.unimi.it/).
All the generators implements rand.Source64 interface and can be used as a drop-in replacement for rand.New() parameter.
Some generators have a Jump() function that is equivalent to call the generator many times.
NOTE: Not concurrency-safe! You can wrap generator with a monitor goroutine, for e.g.
Directories ¶
Path | Synopsis |
---|---|
Package splitmix64 generator is a fixed-increment version of Java 8's SplittableRandom generator.
|
Package splitmix64 generator is a fixed-increment version of Java 8's SplittableRandom generator. |
Package xoroshiro128plus (XOR/rotate/shift/rotate) is the successor to xorshift128+, fastest generator for floating-point numbers.
|
Package xoroshiro128plus (XOR/rotate/shift/rotate) is the successor to xorshift128+, fastest generator for floating-point numbers. |
Package xoroshiro128starstar (XOR/rotate/shift/rotate) all-purpose generator with 128 bits internal state.
|
Package xoroshiro128starstar (XOR/rotate/shift/rotate) all-purpose generator with 128 bits internal state. |
Package xoroshiro256plus (XOR/rotate/shift/rotate) with 256 bits internal state, fast generator for floating-point numbers.
|
Package xoroshiro256plus (XOR/rotate/shift/rotate) with 256 bits internal state, fast generator for floating-point numbers. |
Package xoroshiro256starstar (XOR/rotate/shift/rotate) all-purpose generator with 256 bits internal state.
|
Package xoroshiro256starstar (XOR/rotate/shift/rotate) all-purpose generator with 256 bits internal state. |
Package xoroshiro512plus (XOR/rotate/shift/rotate) with internal 512 bits state, fast generator for floating-point numbers.
|
Package xoroshiro512plus (XOR/rotate/shift/rotate) with internal 512 bits state, fast generator for floating-point numbers. |
Package xoroshiro512starstar (XOR/rotate/shift/rotate) all-purpose generator with internal 512 bits state.
|
Package xoroshiro512starstar (XOR/rotate/shift/rotate) all-purpose generator with internal 512 bits state. |
Package xorshift1024star it's like other xorshift*, generators, but with a 2^1024 -1 period.
|
Package xorshift1024star it's like other xorshift*, generators, but with a 2^1024 -1 period. |
Package xorshift1024starphi it's like others xorshift* generators, but it use a different multiplier (a fixed-point representation of the golden ratio).
|
Package xorshift1024starphi it's like others xorshift* generators, but it use a different multiplier (a fixed-point representation of the golden ratio). |
Package xorshift128plus is 64-bit version of Saito and Matsumoto's XSadd generator.
|
Package xorshift128plus is 64-bit version of Saito and Matsumoto's XSadd generator. |
Package xorshift4096star it's like other xorshift*, generators, but with a 2^4096 - 1 period.
|
Package xorshift4096star it's like other xorshift*, generators, but with a 2^4096 - 1 period. |
Package xorshift64star it's like other xorshift*, generators, but with a 2^64 - 1 period.
|
Package xorshift64star it's like other xorshift*, generators, but with a 2^64 - 1 period. |