Possible Duplicate:
What's the Best Way to Shuffle an NSMutableArray?
iam developing one application.In that i have one array.That contain 5 values 1,2,3,4,5.ANd i want to display that values in random manner.For example first time it display 3 2 4 5 1.And second time 1 3 2 4 5.Like this every time i want to change the order.So please tell me how to do this one.
sample code:
int i = arc4random() % 4;
NSString value = [arr objectAtIndex: i]
[arr removeObjectAtIndex: i];
repeat the steps till you have an empty array.