consensus/utils/xorshift64star.go

11 lines
269 B
Go
Raw Permalink Normal View History

2023-03-07 17:57:06 +00:00
package utils
// XorShift64Star Implementation of xorshift* https://en.wikipedia.org/wiki/Xorshift#xorshift*
// x must be initialized to a non-zero value
2023-03-07 17:57:06 +00:00
func XorShift64Star(x uint64) uint64 {
x ^= x >> 12
x ^= x << 25
x ^= x >> 27
return x * 0x2545F4914F6CDD1D
}