Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // write static methods here
- public static double [] calcDarts(double [] trial, int numtrials)throws IOException
- {
- double x;
- double y;
- for(int n = 0; n < numtrials; n++)
- {
- x = Math.random();
- y = Math.random();
- double radius = (Math.pow(x, 2) + Math.pow(y,2));
- if(radius <= 1)
- trial = trial / numtrials * 4;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement