public static List <Tuple <ShearTriangle2D, ShearTriangle2D> > RandomShearSamples(int nbSamples)
        {
            var samples = new List <Tuple <ShearTriangle2D, ShearTriangle2D> >();
            var counter = 0;
            var rnd     = new Random();

            while (counter < nbSamples)
            {
                // choose B on y-axis: (0, b)
                var b = rnd.NextDouble();

                // choose C: (c_x, c_y)
                var    c_x      = rnd.NextDouble();
                double c_y      = .0;
                var    C_InDisc = false;

                while (!C_InDisc)
                {
                    c_y      = rnd.NextDouble();
                    C_InDisc = c_x * c_x + c_y * c_y < 1.0;
                }

                // choose C_sheared: (c_x, c_y_sheared)
                double c_y_sheared      = .0;
                var    C_sheared_InDisc = false;

                while (!C_sheared_InDisc)
                {
                    c_y_sheared      = rnd.NextDouble();
                    C_sheared_InDisc = c_x * c_x + c_y_sheared * c_y_sheared < 1.0;
                }

                var triangle = new ShearTriangle2D(new double[3] {
                    .0, .0, b
                }, new double[3] {
                    .0, c_x, c_y
                });
                var triangleSheared = new ShearTriangle2D(new double[3] {
                    .0, .0, b
                }, new double[3] {
                    .0, c_x, c_y_sheared
                });

                samples.Add(new Tuple <ShearTriangle2D, ShearTriangle2D>(triangle, triangleSheared));
                counter++;
            }

            return(samples);
        }
        public static List <Triangle> RandomSamples(int nbSamples, double maxNorm = .5)
        {
            var samples = new List <Triangle>();
            var counter = 0;
            var rnd     = new Random();

            while (counter < nbSamples)
            {
                // choose B: (b_x, b_y)
                var b_x      = .0;
                var b_y      = .0;
                var B_InDisc = false;

                while (!B_InDisc)
                {
                    b_x      = rnd.NextDouble();
                    b_y      = rnd.NextDouble();
                    B_InDisc = b_x * b_x + b_y * b_y < maxNorm;
                }

                // choose C: (c_x, c_y)
                var c_x      = .0;
                var c_y      = .0;
                var C_InDisc = false;

                while (!C_InDisc)
                {
                    c_x      = rnd.NextDouble();
                    c_y      = rnd.NextDouble();
                    C_InDisc = c_x * c_x + c_y * c_y < maxNorm;
                }

                var triangleSheared = new ShearTriangle2D(new double[3] {
                    .0, b_x, b_y
                }, new double[3] {
                    .0, c_x, c_y
                });

                samples.Add(triangleSheared.ToTriangle());
                counter++;
            }

            return(samples);
        }