1
0
mirror of https://github.com/golang/go synced 2024-07-05 09:50:19 +00:00

math/rand: document that Source returned by NewSource implements Source64

Fixes #44488

Change-Id: I570950799788678b9dc6e9ddad894973b4611e09
Reviewed-on: https://go-review.googlesource.com/c/go/+/425974
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Jonathan FOng 2022-08-26 12:10:32 -07:00 committed by Joseph Tsai
parent ccab2fbc30
commit 8e35910640

View File

@ -40,7 +40,12 @@ type Source64 interface {
// NewSource returns a new pseudo-random Source seeded with the given value.
// Unlike the default Source used by top-level functions, this source is not
// safe for concurrent use by multiple goroutines.
// The returned Source implements Source64.
func NewSource(seed int64) Source {
return newSource64(seed)
}
func newSource64(seed int64) Source64 {
var rng rngSource
rng.Seed(seed)
return &rng