Welcome to SO. This is not a site where you get other people to write your code for you. It’s a site to ask for help with code you write yourself.
You want to use arc4random_uniform()
to create a random number, and then scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
to fire your timer at a random time in the future.
Try that, and if you have problems, update your question with the code you’re trying and tell us what happens with it.
Edit:
Here’s a suggestion: log a few values of randomNumber. Are they small values? Those are a delay in seconds. If you are getting values of 1000, 1,000,000, or greater, it’s going to take a while for your timer to fire.
2
solved Random generator based off NStimer Xcode 7 swift 2 [closed]