生成随机整数

it2025-10-25  6

 

生成0和1的随机数

new Random().nextInt(2)

生成1到10的随机数

new Random().nextInt(10)+1

 

最新回复(0)