0

i'm developing an app with Theos and i want to add a random image generator. i have an nsarray of image and i don't know how to use arc4random (). can you help me showing some sample code? (:

  • 1
    http://stackoverflow.com/questions/160890/generating-random-numbers-in-objective-c or http://stackoverflow.com/questions/4435905/arc4random-random-number-generator to actually get the random value. Is that what you're interested in - is there anything else? – Rup Aug 30 '12 at 09:08

1 Answers1

2
int k = arc4random_uniform(myArray.count);

UIImageView *picToShow = [myArray objectAtIndex:k]; // show image
Kaan Dedeoglu
  • 14,765
  • 5
  • 40
  • 41