NextDoubleFullRange() public method

Returns a random double from the full range of possible double values. The sign, mantissa and the exponent are independent random numbers, thus the distribution of numbers is not uniform.
public NextDoubleFullRange ( ) : double
return double
コード例 #1
0
ファイル: SumTests.cs プロジェクト: govert/RobustGeometry.NET
        public void FastTwoSum_ResultsNonOverlappingNonAdjacent_Random()
        {
            var rnd = new RandomDouble(1); // Use a specific seed to ensure repeatability
            int testCount = 1000000;
            int testsPerformed = 0;

            for (int i = 0; i < testCount; i++)
            {
                double a = rnd.NextDoubleFullRange();
                double b = rnd.NextDoubleFullRange();
                double x; double y;

                if (Math.Abs(a) >= Math.Abs(b))
                {
                    testsPerformed++;
                    EA.FastTwoSum(a, b, out x, out y);
                    Assert.IsTrue(ExpansionExtensions.AreNonOverlapping(x, y));
                    Assert.IsTrue(ExpansionExtensions.AreNonAdjacent(x, y));
                }
            }

            Debug.Print("FastTwoSum_MaintainsNonOverlapping_Random Tested {0} out of {1} tries", testsPerformed, testCount);
        }
コード例 #2
0
ファイル: SumTests.cs プロジェクト: govert/RobustGeometry.NET
        public void TwoSum_ResultsNonOverlappingNonAdjacent_Random()
        {
            var rnd = new RandomDouble(1); // Use a specific seed to ensure repeatability
            int testCount = 1000000;

            for (int i = 0; i < testCount; i++)
            {
                double a = rnd.NextDoubleFullRange();
                double b = rnd.NextDoubleFullRange();
                double x; double y;

                EA.TwoSum(a, b, out x, out y);
                Assert.IsTrue(ExpansionExtensions.AreNonOverlapping(x, y));
                Assert.IsTrue(ExpansionExtensions.AreNonAdjacent(x, y));
            }

        }