members是未筛选前所有的数据
winMembers是已经筛选出存在的数据
me是自身数据
var members : [Int] = [0 , 1 ,2 ,3 ,4 ,5 ,6] //总成员
var winMembers : [Int] = [0 ,2, 3, 4, 6] //获奖成员
var me : Int = 5 //自己
func getMemberWith(members : [Int]){
var index = Int(arc4random()) % members.count
var isGoOn : Bool = true
var count = 0
repeat{
count += 1
if winMembers.contains(members[index]) || members[index] == me{
//已获奖的包含抽出的这个人或者是自己
print("重复")
index = (index + 1) % members.count
}else{
//中奖
isGoOn = false
winMembers.append(members[index])
print("中奖\(members[index])")
}
}while isGoOn && count < 10
}