Skip to content

Commit

Permalink
math/rand: deprecate Read
Browse files Browse the repository at this point in the history
For #20661.

Change-Id: I1e638cb619e643eadc210d71f92bd1af7bafc912
Reviewed-on: https://go-review.googlesource.com/c/go/+/436955
Reviewed-by: Ian Lance Taylor <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: hopehook <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Robert Griesemer <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
  • Loading branch information
hopehook authored and gopherbot committed Oct 27, 2022
1 parent 612bb34 commit 599a1e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/math/rand/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 599a1e4

Please sign in to comment.