() Method to generate a random number using Math.random

Generation interval [0,1);

// compute a random number equation: * (Max - Min + 1) + min

// find a random number between 200-18

//double rendom=Math.random();

//System.out.println(rendom);

for(int i=0;i<10;i++) {

int num = (int) (Math.random () * ((200-18) +1) +18); // int type of strongly Switch

System.out.println(num);

Guess you like

Origin blog.csdn.net/weixin_40873693/article/details/78482984