diff --git a/unmaintained/stress_filer_upload/write_files/write_files.go b/unmaintained/stress_filer_upload/write_files/write_files.go index 40c13d649..508e37d14 100644 --- a/unmaintained/stress_filer_upload/write_files/write_files.go +++ b/unmaintained/stress_filer_upload/write_files/write_files.go @@ -33,7 +33,7 @@ func main() { f, err := os.Create(fmt.Sprintf("%s/file%05d", *toDir, i)) check(err) - fileSize := *minSize + rand.IntN(*maxSize-*minSize) + fileSize := *minSize + rand.Intn(*maxSize-*minSize) startTime := time.Now() fmt.Printf("write %s %d bytes: ", f.Name(), fileSize) diff --git a/weed/filer/filechunks_test.go b/weed/filer/filechunks_test.go index a99768d6e..4ae7d6133 100644 --- a/weed/filer/filechunks_test.go +++ b/weed/filer/filechunks_test.go @@ -5,7 +5,7 @@ import ( "fmt" "log" "math" - "math/rand" + "math/rand/v2" "strconv" "testing" diff --git a/weed/storage/volume_vacuum_test.go b/weed/storage/volume_vacuum_test.go index 710e4a76a..797452bb3 100644 --- a/weed/storage/volume_vacuum_test.go +++ b/weed/storage/volume_vacuum_test.go @@ -157,7 +157,7 @@ func doSomeWritesDeletes(i int, v *Volume, t *testing.T, infos []*needleInfo) { } // println("written file", i, "checksum", n.Checksum.Value(), "size", size) if rand.Float64() < 0.03 { - toBeDeleted := rand.IntN(i) + 1 + toBeDeleted := rand.Intn(i) + 1 oldNeedle := newEmptyNeedle(uint64(toBeDeleted)) v.deleteNeedle2(oldNeedle) // println("deleted file", toBeDeleted) @@ -175,7 +175,7 @@ type needleInfo struct { func newRandomNeedle(id uint64) *needle.Needle { n := new(needle.Needle) - n.Data = make([]byte, rand.IntN(1024)) + n.Data = make([]byte, rand.Intn(1024)) rand.Read(n.Data) n.Checksum = needle.NewCRC(n.Data) diff --git a/weed/util/skiplist/skiplist_test.go b/weed/util/skiplist/skiplist_test.go index dcd313ff4..c5116a49a 100644 --- a/weed/util/skiplist/skiplist_test.go +++ b/weed/util/skiplist/skiplist_test.go @@ -2,7 +2,7 @@ package skiplist import ( "bytes" - "math/rand" + "math/rand/v2" "strconv" "testing" )