title: C# does array.length start from 0?
body: <p>I know that when you're referencing an array it starts from 0, but does array.length start from 0 or does it start from 1?</p>
  
  <p>Because if I specify an array size to be 10, I reference it 0-9, does this mean array.length is 0-9?</p>
  
  <p>I'm asking because I'm using array.length as the maximum size of a randomly generated number but I'm doing it like this</p>
  
  <pre><code>randomArrayPointer = randomIntNum( 0 , ( posPercents.Length - 1 ) ); //generates a random number that fits the arrays range
  if( randomArrayPointer &lt; posPercents.Length ) //ensures the integer is less than the length of the array
  {
      return ( posPercents [ randomArrayPointer ] );
  }
  else
  {
      return ( posPercents [ 0 ] );
  }
  </code></pre>
  
  <p>Here is my method randomIntNumber (I +1 to the maximum because when specifying 1 to 10 as the inputs for Random() it will give me a number between 0-9)</p>
  
  <pre><code>public static int randomIntNum( int min , int max )
  {
      if( max != 1 &amp; ( max != ( min + 1 ) ) ) //if max isn't 1 and max isn't the minimum + 1
      {
          max = max - 1; //remove 1, this corrects the random generator so that the parameters sent don't need adjusting
      }
      int newInt;
      newInt =  rnd.Next( min , max );
      return ( newInt );
  }
  </code></pre>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>This is my method now, thanks everyone.</p>
  
  <pre><code>    public static double randomPercentChange( Boolean? positive )
      {
          if( positive == true )
          {
              return ( posPercents [ rnd.Next( posPercents.Length ) ] );
          }
          else if( positive == false )
          {
              return ( negPercents [ rnd.Next( negPercents.Length ) ] );
          }
          else if( positive == null )
          {
              return ( 1 );
          }
          return 1;
      }
  </code></pre>
  
  <p>EDIT 2: 4 years on I am sorely embarrassed by this question, but it is a great reference point for progress</p>