Don't mind me. You may notice some changes to the formatting while I play with things and try to come up with a good presentation that works for Objective-C source code. I don't know Blogger's templating very well yet, so there may be some debris and dust while I rennovate.
Here is a test of formatting using TextMate's "Export to HTML" functionality, which I never even knew was there.
#import "NSArray-Shuffle.h"
@implementation NSArray(Shuffle)
-(NSArray *)shuffledArray
{
NSMutableArray *array = [NSMutableArray arrayWithCapacity:[self count]];
NSMutableArray *copy = [self mutableCopy];
while ([copy count] > 0)
{
int index = arc4random() % [copy count];
id objectToMove = [copy objectAtIndex:index];
[array addObject:objectToMove];
[copy removeObjectAtIndex:index];
}
[copy release];
return array;
}
@end
No comments:
Post a Comment