title: arc4random: limit the value of the random number generated
body: <p>Built an iPhone app that generates a random number to a label when a button is pressed.</p>
  
  <p>It works fine, but any value I put doesn't seem to limit the value of the random number generated. it's always 9 digits.</p>
  
  <pre><code>-(IBAction)genRandnum:(id)sender {
  
      NSNumber *randomNumber = [NSNumber numberWithInt: (arc4random() % 5) + 1];
  
      NSNumber *randomLabeltxt = [[NSString alloc] initWithFormat:@"It worked!", randomNumber];
      randLabel.text = [NSString stringWithFormat: @"%d", randomLabeltxt];
      [randomLabeltxt release];
  }
  </code></pre>
  
  <p>As you can see, I've put 5 in after the % sign, but it generates 9 digit numbers.</p>