Skip to content

Commit

Permalink
Guard against train size > total tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
anandthakker committed Jul 25, 2016
1 parent 98603af commit bb14d72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sample
Expand Up @@ -23,7 +23,7 @@ countLines(tiles, function (err, total) {
total = total * Math.pow(4, zoomLevel - realZoom)
}
sample = []
while (sample.length < trainSize) {
while (sample.length < trainSize && sample.length < total) {
var l = Math.floor(Math.random() * total)
if (sample.indexOf(l) < 0) { sample.push(l) }
}
Expand Down

0 comments on commit bb14d72

Please sign in to comment.