//  ------------------------------------------------------
//  -------  Empirische Verteilung        ----------------
//  -------  von Rosinen in Brötchen      ----------------
//  -------                               ----------------
//  -------  16.02.2005    M. Vogel       ----------------
//  ------------------------------------------------------

public class RosinenImTeig
{
	final static int M = 1000000                    ;
	final static int N =  100                       ;
	
	public static void main(String[] args)
	{
     	int[] f = new int[100]                      ;
	    int[] E = new int[5]                        ;
		
      for (int n = 0; n<M; n++)
	  {
        for (int i = 0; i < N ; i++) f[i]=0         ;
	    for (int i = 0; i < N ; i++) f[zufall()]++  ;
			
		for (int i = 0; i < 100; i++) 
			if(f[i]<=3)
			    E[f[i]]++                           ;
			  else
			    E[4]++                              ;
	  }	
	  
	  for (int j = 0; j < 5; j++)
	  	   	System.out.println(j + " -> " + (float)E[j] /M )  ;
			
	}
	
	static int zufall()
	{
		return (int)( 100*Math.random() );
	}
	
}

