How to grab a random element from an array without grabbing the same element more than once? [duplicate]
问题 This question already has answers here : How do I shuffle an array in Swift? (25 answers) Closed 4 years ago . When I grab an element from an array using the arc4random_uniform() method, the same element the array is often grabbed more than once. I am trying to make it so each element in the array is grabbed only once. The reason I'm trying to do this is so more than one cells in a UITableView don't have the same text. Here's the array for the text of the cells in the UITableView : var