lundi 30 novembre 2015

random timer generator for swift in xcode [duplicate]

This question is an exact duplicate of:

I want a function to be called at random times while the user is playing. For example after 2 seconds passed a function is called and then after another 6 seconds it is called again. How do I do that?

This is not working

    func time() {
randomNumber = CGFloat((drand48())
timer = NSTimer.scheduledTimerWithTimeInterval(randomNumber, traget: self, selector: "startTimer", userInfo: nil, repeats: true)

Xcode is not liking it and I donot know why




Aucun commentaire:

Enregistrer un commentaire