Skip to content

Instantly share code, notes, and snippets.

@dbaldwin
Created July 24, 2012 16:24
Show Gist options
  • Save dbaldwin/3171007 to your computer and use it in GitHub Desktop.
Save dbaldwin/3171007 to your computer and use it in GitHub Desktop.
iOS gist for randomly getting a value from a static array
NSArray *upcs = [NSArray arrayWithObjects:@"018208254682", @"885909459865", @"885909480982", @"989898293469", @"725882475691", @"9780060766863", @"9780066620992", nil];
NSString *upc = [upcs objectAtIndex:random()%[upcs count]];
[product setValue: upc forKey: @"upc"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment