[cocos2d-iPhone] cocos2d-iPhone中隐藏的洗牌程序
shuffle
随机打乱一个整数数组的排列:
在"CCActionTiledGrid.m"文件中
-(void)shuffle:(NSUInteger*)array count:(NSUInteger)len { NSInteger i; for( i = len - 1; i >= 0; i-- ) { NSInteger j = rand() % (i+1); NSUInteger v = array[i]; array[i] = array[j]; array[j] = v; } }