aboutsummaryrefslogtreecommitdiff
path: root/weed/operation
diff options
context:
space:
mode:
Diffstat (limited to 'weed/operation')
-rw-r--r--weed/operation/lookup.go4
-rw-r--r--weed/operation/submit.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/weed/operation/lookup.go b/weed/operation/lookup.go
index 6c89c17b1..9e9c719b5 100644
--- a/weed/operation/lookup.go
+++ b/weed/operation/lookup.go
@@ -6,7 +6,7 @@ import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/pb"
"google.golang.org/grpc"
- "math/rand"
+ "math/rand/v2"
"strings"
"time"
@@ -51,7 +51,7 @@ func LookupFileId(masterFn GetMasterFn, grpcDialOption grpc.DialOption, fileId s
if len(lookup.Locations) == 0 {
return "", jwt, errors.New("File Not Found")
}
- return "http://" + lookup.Locations[rand.Intn(len(lookup.Locations))].Url + "/" + fileId, lookup.Jwt, nil
+ return "http://" + lookup.Locations[rand.IntN(len(lookup.Locations))].Url + "/" + fileId, lookup.Jwt, nil
}
func LookupVolumeId(masterFn GetMasterFn, grpcDialOption grpc.DialOption, vid string) (*LookupResult, error) {
diff --git a/weed/operation/submit.go b/weed/operation/submit.go
index 66d5542af..73e50cc48 100644
--- a/weed/operation/submit.go
+++ b/weed/operation/submit.go
@@ -4,7 +4,7 @@ import (
"context"
"github.com/seaweedfs/seaweedfs/weed/pb"
"io"
- "math/rand"
+ "math/rand/v2"
"mime"
"net/url"
"os"
@@ -236,7 +236,7 @@ func genFileUrl(ret *AssignResult, id string, usePublicUrl bool) string {
fileUrl = "http://" + ret.PublicUrl + "/" + id
}
for _, replica := range ret.Replicas {
- if rand.Intn(len(ret.Replicas)+1) == 0 {
+ if rand.IntN(len(ret.Replicas)+1) == 0 {
fileUrl = "http://" + replica.Url + "/" + id
if usePublicUrl {
fileUrl = "http://" + replica.PublicUrl + "/" + id