title: Dynamically create a NSString stringWithFormat: output
body: <p>trying to figure out how to add zeroes in front of a random generated number with dynamic length of the number.
  For example if the number is 10 characters long, I can print the number as   stringWithFormat:@"%.10d",i</p>
  
  <p>Since the numer can somtimes be shorter than maximum length, it needs zeroes to fill the maximum length of the number to fit the string.</p>
  
  <pre><code>- (void)method:(int)length{
  int i = rand() % length;
  NSLog (@"%@",[NSString stringWithFormat:@"%.'length'd",i]);
  }
  </code></pre>