- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
if(self.model.allContestantImages.allKeys.count > 0 && clearArrayContent.count > 0)
{
while (self.model.allContestantImages[topMemberId] == nil ||
self.model.allContestantImages[bottomMemberId] == nil )
{
contestIndex = (arc4random() % clearArrayContent.count); // <---------- HERE
dictContent = clearArrayContent[contestIndex];
topMemberId = [dictContent[@"top_member_id"] knzIdentifier];
bottomMemberId = [dictContent[@"bottom_member_id"] knzIdentifier];
}
}
Писал я как-то явный гк вида a[b[c[d]]], который выносил мозг при чтении. А там был всего лишь вывод в случайном порядке результатов жеребьёвки...
https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/index.html#//apple_ref/occ/instp/NSArray/count
>>@property(readonly) NSUInteger count