//  ------------------------------------------------------
//  -------  Pruefung 4.22 4.)    Ib03    ----------------
//  -------                               ----------------
//  -------  Scheiben-Schiessen           ----------------
//  -------  2-dim Normalverteilung       ----------------
//  -------                               ----------------
//  -------  30.06.2005    M. Vogel       ----------------
//  ------------------------------------------------------

import java.util.*;

public class Pruefung4_22_4
{
	final static int M = 100000 ; // Anzahl Simulationen
	final static int S = 24 ;     // Anzahl Schuesse
	final static double sigmaHor = 0.15 ;  //  
	final static double sigmaVer = 0.10;  //  
	
	public static void main(String[] args){
	double x,y,r;
	int  hit,sum,kranz;
	
	Random gauss = new Random();
	
	kranz = 0;
 	
       for (int n = 0; n<M; n++) {
	   sum=0;
	     for (int s = 0; s<S; s++) {
	        x = sigmaHor * gauss.nextGaussian( ) ;
	        y = sigmaVer * gauss.nextGaussian( ) ;
	        r = Math.sqrt( x*x + y*y ) ;
	        hit = (int) (6-(10.0*r)) ;
	        if (hit < 0) hit = 0;
//	        System.out.println("x y r " + x  + " " + y + " "+ r + "   hit = "+ hit ) ;
	        sum += hit;
	     }
//	  System.out.println(" Treffer " + sum  ) ;
      if( sum >= 100) kranz++ ;
	  
      }	
	
	System.out.println(" Wahrscheinlichkeit fuer einen Kranz " + (double)kranz/M  ) ;
	}
		
}

