01| import java.lang.*;
02| 
03| public class MyProgram {
04| 
05|     public static void main(String[] args) {
06|         int checkCount = 0, inCount = 0;
07|         
08|         for(int i=0 ; i<10000 ; i++){
09|             double x, y;
10|             x = Math.random();
11|             y = Math.random();
12|             if(x*x+y*y<=1){
13|                 inCount++;
14|             }
15|             checkCount++;
16|         }
17|         double myPi = ((double)inCount/(double)checkCount)*4;
18|         System.out.println("試した回数 : " + checkCount);
19|         System.out.println("入った回数 : " + inCount);
20|         System.out.println("計算したπの値 : " + myPi);
21|         
22|     }
23| 
24| }