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; }
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); }