Random
- a objection to generate random numbers
- the random numbers are in the range of the variable’s type but won’t exceed it.
import java.util.Random;
public class TestRandom {
public static void main(String[] args) {
Random r = new Random();
//the random numbers are in the range of the
//variable's type but won't exceed it.
int randon_num = r.nextInt();
//range:[0:10)
int randon_num_range = r.nextInt(10);
System.out.println(randon_num);
}
}