int random = (int) (Math.floor(Math.random() * (max - min + 1)) + min); 代码如上图所示,max为最大整数,min为最小整数。 记得点个赞再走,谢谢!