]> Cypherpunks repositories - gostls13.git/commitdiff
math/rand: deprecate Read
authorhopehook <hopehook.com@gmail.com>
Fri, 30 Sep 2022 01:17:11 +0000 (09:17 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 27 Oct 2022 04:32:55 +0000 (04:32 +0000)
For #20661.

Change-Id: I1e638cb619e643eadc210d71f92bd1af7bafc912
Reviewed-on: https://go-review.googlesource.com/c/go/+/436955
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

src/math/rand/rand.go

index 2d45a28280b122b981301b7ce3dea96c5258f7e4..f6b015aba2494b0405b644f4b51f972c0d47db93 100644 (file)
@@ -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