コード例 #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            var random = new Random();

            int count = random.Next(500, 1500);

            double[] _testArray = new double[count];

            for (int n = 0; n < count; n++)
            {
                _testArray[n] = random.NextGaussian() * 15;
                //_testArray[n] = random.NextTriangular(0,1,2) * 15;
                //_testArray[n] = random.NextDouble() * 15;
            }

            var histogram = new Histogram();

            histogram.AddRange(_testArray);

            GenerateHistogram(histogram, NumberOfBins.SquareRoot);
            GenerateHistogram(histogram, NumberOfBins.SquareRoot, true);

            GenerateHistogram(histogram, NumberOfBins.Sturges);
            GenerateHistogram(histogram, NumberOfBins.RiceRule);
            GenerateHistogram(histogram, NumberOfBins.ScottsNormalReferenceRule);

            Console.WriteLine();
            Console.ReadKey();
        }
コード例 #2
0
 public UnitTestHistogram()
 {
     _histogram = new Histogram();
     _histogram.AddRange(_testArray);
     //
     histogramSquareRoot = _histogram.Generate(NumberOfBins.SquareRoot);
     histogramRice       = _histogram.Generate(NumberOfBins.RiceRule);
     histogramScott      = _histogram.Generate(NumberOfBins.ScottsNormalReferenceRule);
     histogramSturges    = _histogram.Generate(NumberOfBins.Sturges);
 }