I am making a game using Swift and SpriteKit where i move an object to random locations based on an array.
The array that is made up of CGPoints:
let
The code below doesn't random the same number.
var currentNo: UInt32 = 0 func randomNumber(maximum: UInt32) -> Int { var randomNumber: UInt32 do { randomNumber = (arc4random_uniform(maximum)) }while currentNo == randomNumber currentNo = randomNumber return Int(randomNumber) }