当前位置: 代码迷 >> 综合 >> 生成随机整数
  详细解决方案

生成随机整数

热度:28   发布时间:2024-03-07 04:38:10.0

 

生成0和1的随机数

new Random().nextInt(2)

生成1到10的随机数

new Random().nextInt(10)+1

 

  相关解决方案