I am trying to generate a random number in Swift:
var amountOfQuestions = 2
var randomNumber = Int(arc4random_uniform(amountOfQuestions - 1)) + 1
but this results in the error:
Cannot convert value of type 'Int' to expected argument type 'UInt32'
What is the problem? Any ideas on what I can do to fix this error?
Declare amountOfQuestions as a UInt32:
var amountOfQuestions: UInt32 = 2
PS: If you want to be grammatically correct it's number of questions.