Generar un numero random
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var numbertxt: UITextField!
@IBOutlet weak var intentoslbl: UILabel!
@IBOutlet weak var mensajelbl: UILabel!
var random = “ “
@IBAction func validar (sender:Any) {
setValues()
}
override fund ViewDidLoad () {
super.ViewDidLoad ()
//Do any additional setup after loading the view, typically from a nib.
}
func SetValues () {
random = string (arc4random_uniform (10))
print (random)
}
}
Comentarios
Publicar un comentario