diff options
Diffstat (limited to 'pare-gt/main.go')
-rw-r--r-- | pare-gt/main.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pare-gt/main.go b/pare-gt/main.go index 0a8b067..5e2daa1 100644 --- a/pare-gt/main.go +++ b/pare-gt/main.go @@ -74,7 +74,7 @@ func samplePrefixes(perctosample int, prefixes Prefixes) (filestomove []string) keys = append(keys, i) } - sample = total / perctosample + sample = (total * perctosample ) / 100 // This ensures the map is looped over deterministically sort.Strings(keys) @@ -85,6 +85,9 @@ func samplePrefixes(perctosample int, prefixes Prefixes) (filestomove []string) continue } numtoget := int(float64(sample) / float64(total) * float64(len)) + if numtoget >= len { + numtoget = len - 1 + } if numtoget < 1 { numtoget = 1 } |