コード例 #1
0
ファイル: MonteCarlo.cs プロジェクト: lewurm/benchmarker
		public static double integrate(int Num_samples)
		{
			
			SciMark.Random R = new SciMark.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;
		}
コード例 #2
0
ファイル: MonteCarlo.cs プロジェクト: modulexcite/benchmarker
        public static double integrate(int Num_samples)
        {
            SciMark.Random R = new SciMark.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);
        }