Example #1
0
        private void selecGenButton_Click(object sender, EventArgs e)
        {
            if (normSelecRadio.Checked)
            {
                select = new NormalSelection();
                NormalFillForm form = new NormalFillForm();

                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    FillNormalSelect(form);
                }

                ClearAllCharts();
                for (int i = 0; i < select.selection.Count; i++)
                {
                    selectionChart.Series["NormalSelection"].Points.AddXY(i + 1, select.selection.ElementAt(i));
                }
                //selectionChart.Series["NormalSelection"].Points.AddXY(-1, select.mathWaiting());
                selectionChart.Series["MathWaiting"].Points.AddXY(-1, select.mathWaiting());
            }


            if (equableSelecRadio.Checked)
            {
                select = new EquableSelection();
                EquableFillForm form = new EquableFillForm();
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    FillEquableSelect(form);
                }
                ClearAllCharts();
                for (int i = 0; i < select.selection.Count; i++)
                {
                    selectionChart.Series["EquableSelection"].Points.AddXY(i + 1, select.selection.ElementAt(i));
                }
                //selectionChart.Series["EquableSelection"].Points.AddXY(-1, select.mathWaiting());
                selectionChart.Series["MathWaiting"].Points.AddXY(-1, select.mathWaiting());
            }

            if (exponentSelecRadio.Checked)
            {
                select = new ExponentialSelection();
                ExponentialFillForm form = new ExponentialFillForm();
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    FillExponentialSelect(form);
                }

                ClearAllCharts();
                for (int i = 0; i < select.selection.Count; i++)
                {
                    selectionChart.Series["ExponentalSelection"].Points.AddXY(i + 1, select.selection.ElementAt(i));
                }
                //selectionChart.Series["ExponentalSelection"].Points.AddXY(-1, select.mathWaiting());
                selectionChart.Series["MathWaiting"].Points.AddXY(-1, select.mathWaiting());
            }
        }
Example #2
0
        void FillExponentialSelect(ExponentialFillForm form)
        {
            if (form.isNumbs)
            {
                double value = 1;
                Random rand  = new Random();

                for (int i = 0; i < Convert.ToInt32(form.textBox1.Text); i++)
                {
                    value = -1 * (Math.Log(rand.NextDouble()) / Convert.ToInt32(form.textBox2.Text));
                    select.selection.Add(Math.Round(value, 2));
                }
                ShowSelection();
            }
        }