mirror of
https://github.com/golang/go
synced 2024-10-04 15:09:59 +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:
parent
ccab2fbc30
commit
8e35910640
|
@ -40,7 +40,12 @@ type Source64 interface {
|
||||||
// NewSource returns a new pseudo-random Source seeded with the given value.
|
// 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
|
// Unlike the default Source used by top-level functions, this source is not
|
||||||
// safe for concurrent use by multiple goroutines.
|
// safe for concurrent use by multiple goroutines.
|
||||||
|
// The returned Source implements Source64.
|
||||||
func NewSource(seed int64) Source {
|
func NewSource(seed int64) Source {
|
||||||
|
return newSource64(seed)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newSource64(seed int64) Source64 {
|
||||||
var rng rngSource
|
var rng rngSource
|
||||||
rng.Seed(seed)
|
rng.Seed(seed)
|
||||||
return &rng
|
return &rng
|
||||||
|
|
Loading…
Reference in a new issue