From: hopehook Date: Fri, 30 Sep 2022 01:17:11 +0000 (+0800) Subject: math/rand: deprecate Read X-Git-Tag: go1.20rc1~519 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=599a1e40c6dc4d02e2d0ae5a22659b49dc327e40;p=gostls13.git math/rand: deprecate Read For #20661. Change-Id: I1e638cb619e643eadc210d71f92bd1af7bafc912 Reviewed-on: https://go-review.googlesource.com/c/go/+/436955 Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: hopehook Auto-Submit: Ian Lance Taylor Reviewed-by: Robert Griesemer Run-TryBot: Ian Lance Taylor --- diff --git a/src/math/rand/rand.go b/src/math/rand/rand.go index 2d45a28280..f6b015aba2 100644 --- a/src/math/rand/rand.go +++ b/src/math/rand/rand.go @@ -377,6 +377,8 @@ func Shuffle(n int, swap func(i, j int)) { globalRand.Shuffle(n, swap) } // Read generates len(p) random bytes from the default Source and // writes them into p. It always returns len(p) and a nil error. // Read, unlike the Rand.Read method, is safe for concurrent use. +// +// Deprecated: For almost all use cases, crypto/rand.Read is more appropriate. func Read(p []byte) (n int, err error) { return globalRand.Read(p) } // NormFloat64 returns a normally distributed float64 in the range