jeudi 3 août 2017

Best way to determine when to call a function randomly (Swift, Xcode)

I currently determine when to do a task randomly within the update(_ currentTime: TimeInterval) function by generating two numbers randomly and doing the task if they are equal. When I do this I call a function I created to generate the random numbers twice, which I think may be an overload after a while.

Does anyone else have an easier or more efficient way to do this?

I am using Swift within Xcode.




Aucun commentaire:

Enregistrer un commentaire