From 599a1e40c6dc4d02e2d0ae5a22659b49dc327e40 Mon Sep 17 00:00:00 2001 From: hopehook Date: Fri, 30 Sep 2022 09:17:11 +0800 Subject: [PATCH] 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 --- src/math/rand/rand.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/math/rand/rand.go b/src/math/rand/rand.go index 2d45a28280b122..f6b015aba2494b 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