diff options
Diffstat (limited to 'ajde/testdata/ReweavableTest/CalculatePI.java')
-rw-r--r-- | ajde/testdata/ReweavableTest/CalculatePI.java | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/ajde/testdata/ReweavableTest/CalculatePI.java b/ajde/testdata/ReweavableTest/CalculatePI.java deleted file mode 100644 index 84ae08583..000000000 --- a/ajde/testdata/ReweavableTest/CalculatePI.java +++ /dev/null @@ -1,26 +0,0 @@ -import java.util.Random; - -public class CalculatePI { - - static Random r = new Random(); - static double piApproximation = 1.0f; - static int repetitions = 500000; - static int iteration = 0; - static double inSquare = 0; - static double inCircle = 0; - - public static void main(String[] args) { - for (iteration = 0;iteration<repetitions;iteration++) approximate(); - piApproximation = (inCircle/inSquare)*4.0f; - System.out.println("After "+repetitions+" iterations, pi is estimated to be "+piApproximation); - } - - public static void approximate() { - double x = r.nextDouble(); - double y = r.nextDouble(); - inSquare++; - if (x*x + y*y < 1) {inCircle++;} - } - - -}
\ No newline at end of file |