|ReleasedLast Release||Dec 2014|
Maintained by Unclaimed.
+ (NSIndexPath *)randomIndexPathInArrays:(NSArray *)arrays excludingIndexPaths:(NSSet *)excludedIndexPaths;
Returns a random index path valid for one of the arrays in
arrays can't be nil and must be an array of arrays. The returned index path will not be in the set of excludedIndexPaths. excludedIndexPaths can be nil or empty.
The order of the arrays in arrays is important. The first array is section 0, the second array is section 1, and so on. The size of the arrays can vary but an array cannot be empty.
Returns nil if:
This method will take longer to return as the number of items in excludedIndexPaths grows as a percent of the total number of elements for all the arrays in arrays.
MSRandomIndexPath uses arc4random_uniform which was available since iOS 4.3.
Alternatively you can directly add the two
NSIndexPath+RandomAdditions.* source files to your project.
The example Xcode project contains a suite of tests so you can use this method with confidence.
If you copy the test file to your project you may need to configure the project so the test target will recognize the files.