spatial/vptree: don't do no work when n is greater than len(s)
MODIFY
spatial/vptree/vptree.go
spatial/vptree/vptree.go
@@ -155,7 +155,7 @@ func (b *builder) selectVantage(s []Comparable, effort int) Comparable {
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]

spatial/vptree: don't do no work when n is greater than len(s)