math.random java 0 or 1 code example Example: math.random java between 1 and 10 ((int) (Math.random()*(maximum - minimum))) + minimum;