You can generate random coordinates by using arc4random_uniform()
function which returns random number between 0 and a given value. Here is an example of how you can use it to generate random coordinates within a loop:
main.swift361 chars7 lines
This code will generate and print 10 sets of random coordinates within the range of (0,0) to (99,99). You can modify the range by changing the argument of arc4random_uniform()
function.
gistlibby LogSnag