How to randomize an NSMutableArray? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: iphone - nsarray/nsmutablearray - re-arrange in random order I have an NSMutableArray that contains 20 objects. Is there any way that I could randomize their order like when you shuffle a deck. (By order I mean their index in the array) Like if I had an array that contained: apple orange pear banana How could I randomize the order so that I could get something like: orange apple banana pear 回答1: Here's some