Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. // write static methods here
  2. public static double [] calcDarts(double [] trial, int numtrials)throws IOException
  3. {
  4. double x;
  5. double y;
  6.  
  7. for(int n = 0; n < numtrials; n++)
  8. {
  9. x = Math.random();
  10. y = Math.random();
  11.  
  12. double radius = (Math.pow(x, 2) + Math.pow(y,2));
  13.  
  14. if(radius <= 1)
  15. trial = trial / numtrials * 4;
  16.  
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement