随机方法修改

This commit is contained in:
meixiongfeng 2023-12-30 11:18:14 +08:00
parent 4dd7f0f4ee
commit 78758b33c9

View File

@ -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})