simple loop..why strange results

Apr 23 2006 9:27 PM
I now know that I know nothing... using System; using System.IO; namespace ADODotNet { public class Class1 {public Random r = new Random(); string[] nodes = new string[] { "192.168.0.0", "192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4", "192.168.0.5", "192.168.0.6", "192.168.0.7", "192.168.0.8", "192.168.0.9" }; public TextWriter tw = new StreamWriter("c:\\populate.txt"); [STAThread] public static void Main() { Class1 mc = new Class1(); for (int i = 0; i <= 299; i++) //mornin mc.putIP(); } public void putIP() { tw.Write(nodes[r.Next(10)]); tw.Write(" , "); tw.Write(tw.NewLine); } } } I thought I'd get 300 lines but instead I get 256...why

Answers (1)