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? (:
Asked
Active
Viewed 191 times
0
-
1http://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 Answers
2
int k = arc4random_uniform(myArray.count);
UIImageView *picToShow = [myArray objectAtIndex:k]; // show image

Kaan Dedeoglu
- 14,765
- 5
- 40
- 41
-
i use your method but the mobile terminal said that i have to declare arc4random_uniform xD – ClausCartel Aug 30 '12 at 10:04
-