John Smith John Smith - 4 months ago 36
Swift Question

random is unavailable in Swift: Use arc4random

Still very very new to swift and I got this error. I was opening some sample code and this is what the result was after I converted to swift 3. I am using Xcode 8.

var imageURL: URL
var detailURL: URL
var imageURLString: String
var detailURLString: String
var color: String
let sessionID: Int=random()%50000 - this is the error


Use the arc4random method:

let sessionID = Int(arc4random_uniform(50000))