Esempio n. 1
0
        private void beforeDraw()
        {
            Dystrybuanta.Columns.Add("Wylosowana", typeof(int));
            Dystrybuanta.Columns.Add("Ile", typeof(int));
            NumberGenerator gen = new NumberGenerator();


            values = new double[liczba_probek];         //os y

            for (var j = 0; j < liczba_probek; j++)     // os x
            {
                values[j] = gen.Wyk(400, out double x); //trend;
            }


            Dystrybuanta.Clear();


            int  DystrybuantaRows        = 0;
            int  prevSmallestNumber      = 0;
            var  prevSmallestNumberCount = 1;
            bool frst = true;

            for (int i = 0; i < liczba_probek; i++)
            //dodawanie liczb do wykresu od najmniejszej do najwiekszej
            {
                var  smallestNumber = values[0];
                var  numberToDell   = 0;
                bool check          = true;

                for (int x = 0; x < values.Length; x++)
                {
                    if (smallestNumber > values[x])
                    {
                        smallestNumber = values[x];
                        numberToDell   = x;
                    }
                }

                if (check)
                {
                    values[numberToDell] = 9999999;
                }
                if (prevSmallestNumber == smallestNumber && !frst)
                // kolejne wystapienia
                {
                    prevSmallestNumberCount++;
                    Dystrybuanta.Rows[DystrybuantaRows - 1]["ILE"] = prevSmallestNumberCount;
                }
                else
                {
                    frst = false;
                    Dystrybuanta.Rows.Add(smallestNumber, 1);
                    prevSmallestNumber      = (int)smallestNumber;
                    prevSmallestNumberCount = 1;
                    DystrybuantaRows++;
                }
            }
        }
Esempio n. 2
0
        private void draw()
        {
            NumberGenerator gen = new NumberGenerator();

            values = new double[10];                //os y

            for (var j = 0; j < liczba_probek; j++) // os x
            {
                var x = gen.Wyk(0.3, out double c); //trend;
                //    double x = gen.Gaussian(0.5,0.2);
                if (x < 0.1)
                {
                    values[0]++;
                }
                else if (x < 0.2)
                {
                    values[1]++;
                }
                else if (x < 0.3)
                {
                    values[2]++;
                }
                else if (x < 0.4)
                {
                    values[3]++;
                }
                else if (x < 0.5)
                {
                    values[4]++;
                }
                else if (x < 0.6)
                {
                    values[5]++;
                }
                else if (x < 0.7)
                {
                    values[6]++;
                }
                else if (x < 0.8)
                {
                    values[7]++;
                }
                else if (x < 0.9)
                {
                    values[8]++;
                }
                else if (x < 1)
                {
                    values[9]++;
                }
            }
        }