modulepackage
0.0.0-20231129160643-2db0e285f2b3
Repository: https://github.com/remerge/go-xorshift.git
Documentation: pkg.go.dev
# README
Lock Free XOR Shift for Go
Package xorshift
provides a pooled, lock-free xorshift+ PRNG source for
math/rand
.
Usage
package main
import (
"fmt"
rand "github.com/remerge/go-xorshift"
)
func main() {
fmt.Println(rand.Int63())
}
# Functions
ExpFloat64 returns an exponentially distributed float64 in the range (0, +math.MaxFloat64] with an exponential distribution whose rate parameter (lambda) is 1 and whose mean is 1/lambda (1) from the default Source.
Float32 returns, as a float32, a pseudo-random number in [0.0,1.0) from the default Source.
Float64 returns, as a float64, a pseudo-random number in [0.0,1.0) from the default Source.
Int returns a non-negative pseudo-random int from the default Source.
Int31 returns a non-negative pseudo-random 31-bit integer as an int32 from the default Source.
Int31n returns, as an int32, a non-negative pseudo-random number in [0,n) from the default Source.
Int63 returns a non-negative pseudo-random 63-bit integer as an int64 from the default Source.
Int63n returns, as an int64, a non-negative pseudo-random number in [0,n) from the default Source.
Intn returns, as an int, a non-negative pseudo-random number in [0,n) from the default Source.
New creates a rand.Rand instance with the given source.
NewSource creates a rand.Source64 instance based on xorshift+.
NormFloat64 returns a normally distributed float64 in the range [-math.MaxFloat64, +math.MaxFloat64] with standard normal distribution (mean = 0, stddev = 1) from the default Source.
Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n) from the default Source.
Read generates len(p) random bytes from the default Source and writes them into p.
Seed uses the provided seed value to initialize the default Source to a deterministic state.
Uint32 returns a pseudo-random 32-bit value as a uint32 from the default Source.
Uint64 returns a pseudo-random 64-bit value as a uint64 from the default Source.