]> Cypherpunks repositories - gostls13.git/commitdiff
math/rand: fix comment for Shuffle
authorBurak Guven <bguven@gmail.com>
Thu, 14 Sep 2017 02:54:40 +0000 (19:54 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 14 Sep 2017 03:41:35 +0000 (03:41 +0000)
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>
src/math/rand/rand.go

index 85871725a6ad0f851b114e8193543977c12c4f39..8edb22e1da9fcd6092ea42ed7ab500c9a0dd1ae6 100644 (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) }