Accord.Tests.Interop.Math.TSNETest.nth_element_test_2 C# (CSharp) Method

nth_element_test_2() private method

private nth_element_test_2 ( ) : void
return void
        public void nth_element_test_2()
        {
            Accord.Math.Random.Generator.Seed = 0;

            for (int n = 0; n < 1000; n++)
            {
                int[] random = Vector.Random(n, 0, 1000);

                var a = (int[])random.Clone();
                a.Sort();

                for (int j = 0; j < n; j++)
                {
                    var b = (int[])random.Clone();
                    double actual = Sort.NthElement(b, j);
                    double expected = a[j];
                    Assert.AreEqual(actual, expected);        
                }
            }
        }