これは非常に基本的な質問だと思いますが、Nick Kuh の本「Foundation iPhone App Development」のチュートリアルを行っていますが、この行の内容を完全には理解していません。
int count = [自己カウント];
...本当に「自分」から始まるの?
コード全体は次のとおりです。
#import "NSMutableArray+Shuffle.h"
@implementation NSMutableArray (Shuffle)
- (void)shuffle {
int count = [self count];
NSMutableArray *dupeArr = [self mutableCopy];
count = [dupeArr count];
[self removeAllObjects];
for (int i = 0; i < count; i++) {
// Select a random element between i and the end of the array to swap with.
int nElement = count - i;
int n = (arc4random() % nElement);
[self addObject:dupeArr[n]];
[dupeArr removeObjectAtIndex:n];
}
}
@end