samedi 8 mars 2014

How to check is a value already exist in NSMutableArray?


Vote count:

0




I'm generating random number and adding it to array. But I don't want duplicates to be there. How do I check if the value already exists in array? Thank you!



int lowerBound = 0;
int long upperBound = numberOfQuestions;
int randomQuestionNumber = lowerBound + arc4random() % (upperBound - lowerBound);
[_randomQuestionNumberArray addObject:[NSDecimalNumber numberWithInt:randomQuestionNumber]];


asked 57 secs ago






Aucun commentaire:

Enregistrer un commentaire