and generate random integer java code example
Example 1: random number in range java
(int)(Math.random() * ((max - min) + 1)) + min
Copy
Example 2: java random usage
import java.util.Random;
Random rndm = new Random();
int mnmbr = 10;
int rndNumber = rndm.nextInt(mnumber) + 1;
System.out.println(rndNumber);