objective c - iPhone - Easiest way to fill an NSMutableArray with randoms ints 0 to 3 -
I want to fill a NSMutableArray with 100 random instances of 0 to 3. I am still struggling with objective- C.
Easiest way?
#include & lt; Stdlib.h & gt; .... NSMutableArray * array = [ability with NSMutableArray array: 100]; For (int i = 0; i & lt; 100; i ++) {[array addObject: [NSNumber numberAttro: arc4random () & amp; 3]]; }
Comments
Post a Comment