1
0
mirror of https://github.com/golang/go synced 2024-10-03 18:21:21 -06:00

math/rand: fix comment for Shuffle

Shuffle panics if n < 0, not n <= 0. The comment for the (*Rand).Shuffle
function is already accurate.

Change-Id: I073049310bca9632e50e9ca3ff79eec402122793
Reviewed-on: https://go-review.googlesource.com/63750
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Burak Guven 2017-09-13 19:54:40 -07:00 committed by Ian Lance Taylor
parent 107744e94c
commit 9cc170f9a5

View File

@ -346,7 +346,7 @@ func Float32() float32 { return globalRand.Float32() }
func Perm(n int) []int { return globalRand.Perm(n) }
// Shuffle pseudo-randomizes the order of elements using the default Source.
// n is the number of elements. Shuffle panics if n <= 0.
// n is the number of elements. Shuffle panics if n < 0.
// swap swaps the elements with indexes i and j.
func Shuffle(n int, swap func(i, j int)) { globalRand.Shuffle(n, swap) }