Random number generator within range java code example
Example 1: java random usage
import java.util.Random;
Random rndm = new Random();
int mnmbr = 10;
int rndNumber = rndm.nextInt(mnumber) + 1;
System.out.println(rndNumber);
Example 2: how to generate random numbers in java within range
import java.util.Random;
Random rand = new Random();
int random_integer = rand.nextInt(upperbound-lowerbound) + lowerbound;