import java.util.Random;
Random rndm = new Random();
int mnmbr = 10;
int rndNumber = rndm.nextInt(mnumber) + 1;
System.out.println(rndNumber);
// Thread safe random number generator.
import java.util.concurrent.ThreadLocalRandom;
// Generate random integers
int val = ThreadLocalRandom.current().nextInt();
// Print random int
System.out.println("Random Integer: " + val);