title: Asp.Net MVC slow function for retrieving random numbers from database
body: <p>I have function called <code>getWords(int wrNum)</code> which returns wrNum number random numbers from database using entity framework and when wrNum is 300 this function takes 10 seconds of time approximately. I can't understand why it takes so much time. Please help what is wrong with my code?</p>
  <pre><code>public List&lt;string&gt; getWords(int wrNum)
  {
      IDVLTest d3 = new DVLTest();
      for (int i = 0; i &lt; wrNum;i++ )
      {
          string word = d3.getRandomWord().Text;
          Words.Add(new WordView { Word = word, Status = WordStatus.Right });
      }
      return Words.Select(w=&gt;w.Word).ToList();
  }
  
  public class DVLTest:IDVLTest
  {
  ...
      public Word getRandomWord()
      {
          Random r = new Random();
          int i = r.Next(DVL_Entitie.Words.Count());
          return DVL_Entitie.Words.ToList().ElementAt(i);
      }
  ...
  }
  </code></pre>