math.random 1 to 6 java in a method code example Example: math.random java between 1 and 10 ((int) (Math.random()*(maximum - minimum))) + minimum;