mirror of https://github.com/golang/go.git
slice, sort: correct triple of xorshift RNG
The original triple is `[13,17,5]` which don't existed in the Xorshift RNG paper. This CL use the right triple `[13,7,17]` for 64 bits RNG. Fixes #70144 Change-Id: I3e3d475835980d9f28451ab73e3ce61eb2f1685e Reviewed-on: https://go-review.googlesource.com/c/go/+/624295 Reviewed-by: Eli Bendersky <eliben@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: yunhao zhang <zhangyunhao116@gmail.com>
This commit is contained in:
parent
375129ab4c
commit
989eed2849
|
|
@ -180,8 +180,8 @@ type xorshift uint64
|
|||
|
||||
func (r *xorshift) Next() uint64 {
|
||||
*r ^= *r << 13
|
||||
*r ^= *r >> 17
|
||||
*r ^= *r << 5
|
||||
*r ^= *r >> 7
|
||||
*r ^= *r << 17
|
||||
return uint64(*r)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ type xorshift uint64
|
|||
|
||||
func (r *xorshift) Next() uint64 {
|
||||
*r ^= *r << 13
|
||||
*r ^= *r >> 17
|
||||
*r ^= *r << 5
|
||||
*r ^= *r >> 7
|
||||
*r ^= *r << 17
|
||||
return uint64(*r)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue