title: Select random record from table with further conditions in C# code
body: <p><p>I'm coding little process where I can select random record from table, where field with checkbox/boolean is also unchecked.
  The moral of the story is to select random record, work with it and set checkbox/boolean field == Checked.
  <p>I have approach this work by selecting random record from Count() method, I got Integer in return and I can choose random number from that pool. But I also need to filter the query to select only records who have the checkbox/boolean field unchecked, but I haven't managed in the following code to go so far.
  <p>I have used Lambda expression as follows but maybe better way can exists.</p>
  
  <pre><code> public class Program
  {
      static void Main(string[] args)
      {
          DatabaseModelContainer mc = new DatabaseModelContainer();
          MyTable myTable = new MyTable();
          Random rnd = new Random();
          int index = rnd.Next(myTable.Count);
  
          string selectedRec = myTable.MyField.OrderBy(r =&gt; myTable.MyField).Take(index).ToString();
  
          //Selected record to be shown at the screen, but will not appear (only reference point is shown) 
          Console.WriteLine(selectedRec);
  
          //Selected random value is displayed here and that indeed worked, I get random value there, but I can't use the id to select record above based on that id.
          Console.WriteLine(index.ToString());
  
          Console.ReadLine();
  
      }
  }
  </code></pre>
  
  <p>Code above does NOT show who to choose random record WHERE CheckboxField == Checked, so that code needs to be added as well.
  <p>What approach is best?</p>