+ (NSArray*)makeRandomIndexArray:(NSUInteger)countOfIndices
{
srand(time(NULL));
NSMutableArray* indices = [[NSMutableArray alloc] initWithCapacity:countOfIndices];
NSMutableArray* tempArray = [[NSMutableArray alloc]initWithCapacity:countOfIndices];
for (NSUInteger i = 0; i < countOfIndices; i++)
{
[tempArray addObject:[NSNumber numberWithInt:i]];
}
for (NSUInteger i = 0; i < countOfIndices; i++)
{
NSUInteger randomNumber = (rand()% (countOfIndices-i) );
NSNumber* number = [tempArray objectAtIndex:randomNumber];
[indices addObject:number];
[tempArray removeObjectAtIndex:randomNumber];
}
[tempArray release];
return (NSArray*)[indices autorelease];
}