Objective-C how to pull several random items out of NSArray without getting duplicates? [duplicate]
问题 This question already has answers here : Getting a random object from NSArray without duplication (3 answers) Closed 3 years ago . I have an array of random properties I would like to assign to equipment within the game I'm developing. The code that I use below is returning an NSArray. I'm interested if there's way to get item indices from that array without getting duplicate values. The obvious solution is to create a mutable array with the returned array, do random, remove item that was