Skip to content

Commit 9cc170f

Browse files
burakguvenianlancetaylor
authored andcommitted
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>
1 parent 107744e commit 9cc170f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/math/rand/rand.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func Float32() float32 { return globalRand.Float32() }
346346
func Perm(n int) []int { return globalRand.Perm(n) }
347347

348348
// Shuffle pseudo-randomizes the order of elements using the default Source.
349-
// n is the number of elements. Shuffle panics if n <= 0.
349+
// n is the number of elements. Shuffle panics if n < 0.
350350
// swap swaps the elements with indexes i and j.
351351
func Shuffle(n int, swap func(i, j int)) { globalRand.Shuffle(n, swap) }
352352

0 commit comments

Comments
 (0)