summaryrefslogtreecommitdiff
path: root/Volta/Additions/NSMutableArray.m
diff options
context:
space:
mode:
authorRonny Fenrich <Fenrich@Gmail.com>2013-06-13 13:40:44 -0600
committerRonny Fenrich <Fenrich@Gmail.com>2013-06-13 13:40:44 -0600
commitbf6c97cdee2264656211126ee01066c3c5d4bd8d (patch)
treedf4a6a9ed1b76109a57d1bf71c85b5632a6e3a0b /Volta/Additions/NSMutableArray.m
parentd6d01c9dd86561ad2121f0f85f0a4529142d5093 (diff)
added Xcode project and converted to CocoaPods (added a bunch of libraries)
Diffstat (limited to 'Volta/Additions/NSMutableArray.m')
-rw-r--r--Volta/Additions/NSMutableArray.m27
1 files changed, 27 insertions, 0 deletions
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