my requirement is generating a random point in a given area, i.e i have an CGRect of some space and i need to generate a rendom point in this rect ..
how can i proceed in this scenario ??
my requirement is generating a random point in a given area, i.e i have an CGRect of some space and i need to generate a rendom point in this rect ..
how can i proceed in this scenario ??
You should generate 2 random values that lie in range of your rect.
Eg. a rect like this (100,50,300,200) will require you to get an x-value between 0 and 300 (your width) and then add 100 to it (your origin). Same will be required for y-value, get a random value between 0 and 200 (height) and add 50 (origin) to it.