if textOfEasyHardLabel == "Hard" { //for hard level code if coins.count == 20 || coins.count == 16 || coins.count == 12 || coins.count == 8 || coins.count == 4 { let numberToDelete = Int(arc4random_uniform(UInt32(3))) for _ in 0..<numberToDelete { let tag = Int(arc4random_uniform(UInt32(coins.count))) coins[tag].hidden = true coins.removeAtIndex(tag) count -= [tag].count } } }
The code does not work correctly. coins.tag always disappears not a random number, but 4, although the condition is from 1 to 3! In connection with what could be such a bug? Maybe there will be ideas ...
count -= [tag].count
? - Max Mikheyenko