diff --git a/main.go b/main.go index 1e65dcb..ab6f695 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "io" "log" "os" + "sort" "sync" "time" @@ -73,6 +74,7 @@ func main() { toCorrupt := int64(float32(filesize) * (float32(*percent) / 100)) indicesToCorrupt := selectRandomIndices(filesize, toCorrupt) + sort.Slice(indicesToCorrupt, func(i, j int) bool { return indicesToCorrupt[i] < indicesToCorrupt[j] }) log.Printf("Corrupting %d bytes in %s", toCorrupt, file) for _, index := range indicesToCorrupt {