📜  如何在java代码示例中生成随机数

📅  最后修改于: 2022-03-11 14:52:32.110000             🧑  作者: Mango

代码示例6
import java.util.Random;

Random rndm = new Random();
int mnmbr = 10;

int rndNumber = rndm.nextInt(mnumber) + 1;

System.out.println(rndNumber);