I generate random numbers and store them in an array:
int RandomNumber = arc4random() % 12;
[NSMutablearray *Number addObject:[NSNumber numberWithInt:RandomNumber]];
Now I want to make sure the same number is not created randomly again.
Can any one please tell me how to do it with sample code.
You can use an
NSMutableSetinstead of an array while generating the numbers.The following code will create an array of 10 unique random numbers: