int max=6; int min=1; //works with negative numbers too!, set to 0 to have it show from 0 to the number. int randomNumber=(int)(Math.random()*max) + min;