FoundationExtension
FoundationExtension is common Foundation/UIKit/Cocoa shortcuts and snippets collection.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
NSArray(Random) Category Reference

Random selection in NSArray objects. More...

#import <NSArray.h>

Instance Methods

(id) - randomObject
 Returns one of the objects in the array, or nil if the array contains no objects. More...
 
(NSArray *) - randomObjectsOfCount:
 Returns an array of random objects of given number in the array without duplication. More...
 
(NSArray *) - shuffledArray
 Returns a new shuffled array from the array;. More...
 

Detailed Description

Random selection in NSArray objects.

Method Documentation

- (id) randomObject

Returns one of the objects in the array, or nil if the array contains no objects.

Returns
One of the objects in the array, or nil if the array contains no objects.
- (NSArray *) randomObjectsOfCount: (NSUInteger)  count

Returns an array of random objects of given number in the array without duplication.

Parameters
countA number of items to select.
Returns
An array of random objects of given number in the array without duplication. If given count is bigger than the size of receiver array, it returns a shuffled array of the array.
- (NSArray *) shuffledArray

Returns a new shuffled array from the array;.


The documentation for this category was generated from the following file: