title: how to add random number to an array
body: <p>This is classwork.  I've been reading and searching and everything is telling me to use the java.util.Random of which I understand how that works and wish I could use it.  but my assignment specifically tells me to use the (int) (Math.random * number) of which I am having difficulty seeing where to apply into my array.  everything I've seen has been the Random pulled from java. 
  It is the generate 100 random integers 0-9 and how many times they occur. If someone can assist?
  My error is - Exception in "main" java.lang.array index out of bounds exemption:10 and obviously there is something in my code wrong too.</p>
  
  <pre><code>public class NumberOfTimes{
  
    public static void main(String[] args){
  
      int rand = (int)(Math.random() * 10);
      int[] counts = new int [10];
  
      for(int i = 0; i &lt; 100; i++){
  
        counts[i]++;
      }//end for
  
      System.out.println("number\t" + "occurence ");
  
      for (int num = 0; num &lt; counts.length; num++){
  
        System.out.println(num + "\t" + counts[num]);
      }//end for
  
    }//end main
  
  }//end NumberOfTimes   
  </code></pre>