Skip to content

Instantly share code, notes, and snippets.

@marutanm
Created August 7, 2013 14:29
Show Gist options
  • Select an option

  • Save marutanm/6174564 to your computer and use it in GitHub Desktop.

Select an option

Save marutanm/6174564 to your computer and use it in GitHub Desktop.
NSarray *fileList = @[@"fileA", @"fileB", @"fileC", @"fileD"];
NSUInteger randomIndex = arc4random() % [fileList count];
NSString *selectedFile = [fileList objectAtIndex:randomIndex];
// http://stackoverflow.com/questions/3318902/picking-a-random-object-in-an-nsarray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment