public static void main(String[] args) { Scanner a = new Scanner(System.in); int x = 0; int y, c, b; y = a.nextInt(); c = a.nextInt(); Random r = new Random(System.currentTimeMillis()); for (x = 0; x < 20; x++) { b = r.nextInt(c) + y; System.out.println(b); } } My code displays random numbers without a range, I can not understand what is wrong, and the values can be negative
new Random(System.currentTimeMillis()). Use justnew Random(). - Tagir Valeev