📜  在 java 中生成随机数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:15.885000             🧑  作者: Mango

代码示例4
import java.lang.Math;

int randomNumber;

int minimum = 1;
int maximum = 10 - minimum;

randomNumber = (int)((Math.random()*maximum) + minimum);

System.out.println("Random Number (Between 1-10): " + randomNumber);