So I want to generate a random number between 0 and numberTextBox.text.
Let's say that the textbox text is 5, then i want to generate a random number between 0 and 5.
I have now:
@IBAction func nextButton(sender: AnyObject) {
let MaxNumber = numberTextBox.text
let randomNumber = random(); MaxNumber
var textString = String(randomNumber)
numberLabel.text = textString
}
But when I test the application, and type 5 in the textBox, the numberLabel.text is something like 192819371.. It's very high.
Aucun commentaire:
Enregistrer un commentaire