This is a pretty simple Java (though probably applicable to all programming) question:
Math.random() returns a number between zero and on
Math.random()
The Random class of Java located in the java.util package will serve your purpose better. It has some nextInt() methods that return an integer. The one taking an int argument will generate a number between 0 and that int, the latter not inclusive.
java.util