commit | 89503b3627cbcf7718866503a835c10d03e4da9c | [log] [tgz] |
---|---|---|
author | Dan Kortschak <dan@kortschak.io> | Tue Jun 15 08:20:01 2021 +0930 |
committer | Dan Kortschak <dan@kortschak.io> | Thu Jun 17 16:43:35 2021 +0930 |
tree | c40ffa0768f000a677a3b1a942c01932dc083266 | |
parent | cb266191d209abbc2acf7c64a7238a94a3b5df96 [diff] |
spatial/vptree: don't do no work when n is greater than len(s)
diff --git a/spatial/vptree/vptree.go b/spatial/vptree/vptree.go index 3b3a3ea..5c94519 100644 --- a/spatial/vptree/vptree.go +++ b/spatial/vptree/vptree.go
@@ -155,7 +155,7 @@ func (b *builder) random(n int, s []Comparable) []Comparable { if n >= len(s) { - return s + n = len(s) } b.shuf(len(s), func(i, j int) { s[i], s[j] = s[j], s[i] }) return s[:n]