mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-26 15:40:01 -07:00
31 lines
510 B
Go
31 lines
510 B
Go
package xorshift
|
|
|
|
import (
|
|
"math/rand"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkRand(b *testing.B) {
|
|
var cnt uint64
|
|
for i := 0; i < b.N; i++ {
|
|
cnt = rand.Uint64()
|
|
}
|
|
_ = cnt
|
|
}
|
|
|
|
func BenchmarkXoRoShiRo128SS(b *testing.B) {
|
|
v, s0, s1 := uint64(0), rand.Uint64(), rand.Uint64()
|
|
for i := 0; i < b.N; i++ {
|
|
v, s0, s1 = XoRoShiRo128SS(s0, s1)
|
|
}
|
|
_, _, _ = v, s0, s1
|
|
}
|
|
|
|
func BenchmarkXorShift64Star(b *testing.B) {
|
|
v, s := uint64(0), rand.Uint64()
|
|
for i := 0; i < b.N; i++ {
|
|
v, s = XorShift64S(s)
|
|
}
|
|
_, _ = v, s
|
|
}
|