title: Generating random questions from a text file - C#
body: <p>I want to provide the user with a selection of questions but I want them to be random, having a quiz game with the same questions isn't exactly fun.</p>
  
  <p>My idea was to store a large collection of questions and there appropiate answers in a text file:</p>
  
  <pre><code>What colour is an Strawberry|Red
  How many corners are there on a Triangle|Three
  </code></pre>
  
  <p>This means that I could simply select a line at random, read the question and answer from the line and store them in a collection to be used in the game.</p>
  
  <p>I've come up with some pseudo code with an approach I think would be useful and am looking for some input as to how it could be improved:</p>
  
  <pre><code>Random rand = new Random();
  int line;
  string question,answer;
  
  for(int i = 0; i &lt; 20; i++)
  {
     line = rand.Next();
     //Read question at given line number to string
     //Read answer at given line number to string
     //Copy question and answer to collection
  }
  </code></pre>
  
  <p>In terms of implementing the idea I'm unsure as to how I can specify a line number to read from as well as how to split the entire line and read both parts separately. Unless there's a better way my thoughts are manually entering a line number in the text file followed by a "|" so each line looks like this:</p>
  
  <pre><code>1|What colour is an Strawberry|Red
  2|How many corners are there on a Triangle|Three
  </code></pre>
  
  <p>Thanks for any help!</p>