var b = Math.floor(Math.random() code example Example: math.random int random = (int) (Math.random()*(max-min+1)+min);