public string getLineFromBrain() { using (StreamReader brainFile = File.OpenText(BRAIN_FILE)) { // This will add all of the lines in the brain file to an array so we can use them ArrayList lines = new ArrayList(); string line; int numberOfLines; while ((line = brainFile.ReadLine()) != null) lines.Add(line); numberOfLines = lines.Count; // Now we need to randomly pick a line and pull a line. //Creating a seed from which we can generate random numbers. DateTime dateTime = DateTime.Now; float mins = dateTime.Minute; float secs = dateTime.Second; float hour = dateTime.Hour; float seed = (secs * mins) + hour; Random randnum = new Random(System.Convert.ToInt32(seed)); int rnd = randnum.Next(numberOfLines); string randomLine = (string)lines[rnd]; brainFile.Close(); return randomLine; } }