Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            seed = int.Parse(textBox1.Text);
            n    = int.Parse(textBox2.Text);

            Generator.Init(seed);
            File.WriteAllText("Plik5.txt", string.Empty);
            FileStream   fileStream   = new FileStream("Plik5.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter streamWriter = new StreamWriter(fileStream);

            for (int i = 0; i < n; i++)
            {
                int    tmp = Generator.LFG();
                string s   = tmp.ToString() + " ";
                listBox1.Items.Add(s);
            }
            foreach (object o in listBox1.Items)
            {
                streamWriter.WriteLine(o.ToString());
            }

            streamWriter.Flush();
            streamWriter.Close();
            fileStream.Close();
        }