From bf6c97cdee2264656211126ee01066c3c5d4bd8d Mon Sep 17 00:00:00 2001 From: Ronny Fenrich Date: Thu, 13 Jun 2013 13:40:44 -0600 Subject: added Xcode project and converted to CocoaPods (added a bunch of libraries) --- Volta/Additions/NSMutableArray.m | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Volta/Additions/NSMutableArray.m (limited to 'Volta/Additions/NSMutableArray.m') diff --git a/Volta/Additions/NSMutableArray.m b/Volta/Additions/NSMutableArray.m new file mode 100644 index 0000000..0d7214b --- /dev/null +++ b/Volta/Additions/NSMutableArray.m @@ -0,0 +1,27 @@ +// +// NSMutableArray+Additions.m +// popquizshow +// +// Created by Ronny Fenrich on 2012-11-14. +// Copyright (c) 2012 Kyle Langille. All rights reserved. +// + +#import "NSMutableArray+Additions.h" + + + + +@implementation NSMutableArray (Shuffling) + +- (void)shuffle +{ + NSUInteger count = [self count]; + for (NSUInteger i = 0; i < count; ++i) { + // Select a random element between i and end of array to swap with. + NSInteger nElements = count - i; + NSInteger n = (arc4random() % nElements) + i; + [self exchangeObjectAtIndex:i withObjectAtIndex:n]; + } +} + +@end \ No newline at end of file -- cgit v1.2.3