diff --git a/modules/equipment/module.go b/modules/equipment/module.go index 93cc483b7..8d8a88d32 100644 --- a/modules/equipment/module.go +++ b/modules/equipment/module.go @@ -1,6 +1,7 @@ package equipment import ( + "crypto/rand" "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" @@ -10,8 +11,7 @@ import ( cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/sys/db" "math" - "math/rand" - "time" + "math/big" "github.com/go-redis/redis/v8" ) @@ -622,8 +622,10 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, suiteId int32, p } return } - r := rand.New(rand.NewSource(time.Now().Unix())) - index := r.Perm(len(lvs))[0] + // 随机方法修改 + n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(lvs)))) + index := n.Int64() //rand.New(rand.NewSource(time.Now().Unix())) + //index := r.Perm(len(lvs))[0] if eruip, err = this.modelEquipment.newEquipment(session.GetUserId(), lvs[index], dyweight, isepic); err == nil { errdata = this.AddEquipment(session, eruip) // this.equipmentsChangePush(session, []*pb.DB_Equipment{eruip})