/* myArray is a NSMutableArray with some objects */ NSUInteger count = [myArray count]; for (NSUInteger i = 0; i < count; ++i) { int nElements = count - i; int n = (arc4random() % nElements) + i; [myArray exchangeObjectAtIndex:i withObjectAtIndex:n]; }