Commit 9cc170f9 authored by Burak Guven's avatar Burak Guven Committed by Ian Lance Taylor

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/63750Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 107744e9
...@@ -346,7 +346,7 @@ func Float32() float32 { return globalRand.Float32() } ...@@ -346,7 +346,7 @@ func Float32() float32 { return globalRand.Float32() }
func Perm(n int) []int { return globalRand.Perm(n) } func Perm(n int) []int { return globalRand.Perm(n) }
// Shuffle pseudo-randomizes the order of elements using the default Source. // 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. // swap swaps the elements with indexes i and j.
func Shuffle(n int, swap func(i, j int)) { globalRand.Shuffle(n, swap) } func Shuffle(n int, swap func(i, j int)) { globalRand.Shuffle(n, swap) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment