private void button2_Click(object sender, EventArgs e) { try { if (txtCount.Text != "" && txtZ0.Text != "" && txtm.Text != "" && txta.Text != "") { int z0 = Convert.ToInt32(txtZ0.Text); int m = Convert.ToInt32(txtm.Text); int a = Convert.ToInt32(txta.Text); int count = Convert.ToInt32(txtCount.Text); if (cmbType.SelectedIndex == 0) { if (txtc.Text != "") { int c = Convert.ToInt32(txtc.Text); var d = MixedCongruentialGenerator.GetNumbers(count, z0, a, c, m, chkZeroToOne.Checked); rtbRandomNumbers.Text = ""; if (d != null) { StringBuilder s = new StringBuilder(); foreach (var i in d) { s.AppendLine(i.ToString()); } rtbRandomNumbers.Text = s.ToString(); } } else { MessageBox.Show("Please, you need to specify c"); } } else { var d = MultiplicativeCongruentialGenerator.GetNumbers(count, z0, a, m, chkZeroToOne.Checked); rtbRandomNumbers.Text = ""; if (d != null) { StringBuilder s = new StringBuilder(); foreach (var i in d) { s.AppendLine(i.ToString()); } rtbRandomNumbers.Text = s.ToString(); } } } else { MessageBox.Show("Please, you need to specify Length, Z0, a and m"); } } catch { MessageBox.Show("Please, check again your numbers"); } }