title: "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
body: <p>For creating a list with 100 random number between 0 and 1 I wrote below code that I receive the error.  </p>
  
  <pre><code>      public List&lt;float&gt; random()
          {
              List&lt;float&gt; storerandomvalues = new List&lt;float&gt;(100);
              Random randomvalues = new Random();
              float randomnum;
              for (int counter = 0; counter &lt; 100; counter++)
              {
                  randomnum = 0f;
                  randomnum = randomvalues.Next(1);
                  storerandomvalues[counter]= randomnum;           //the error
              }
              return storerandomvalues;
          }
  </code></pre>