package lottery_service import ( "math/rand" "time" ) type LotteryUser struct { UserId int64 Username string UserPhone string Avatar string PrizeName string LadderId int64 PrizeImg string } func RandLotteryUser(users []*LotteryUser) { r := rand.New(rand.Source(rand.NewSource(time.Now().Unix()))) if len(users) <= 0 { return } for i := len(users) - 1; i > 0; i-- { num := r.Intn(i + 1) users[i], users[num] = users[num], users[i] } }