Example #1
0
        public static double integrate(int Num_samples)
        {
            Scimark_Csharp_Android.Random R = new Scimark_Csharp_Android.Random(SEED);

            int under_curve = 0;
             for (int count = 0; count < Num_samples; count++)
            {
                double x = R.nextDouble();
                double y = R.nextDouble();

                if (x * x + y * y <= 1.0)
                    under_curve++;

            }

            return ((double) under_curve / Num_samples) * 4.0;
        }
Example #2
0
        public static double integrate(int Num_samples)
        {
            Scimark_Csharp_Android.Random R = new Scimark_Csharp_Android.Random(SEED);


            int under_curve = 0;

            for (int count = 0; count < Num_samples; count++)
            {
                double x = R.nextDouble();
                double y = R.nextDouble();

                if (x * x + y * y <= 1.0)
                {
                    under_curve++;
                }
            }

            return(((double)under_curve / Num_samples) * 4.0);
        }