Random类的常用方法

1、nextBoolean():

随机返回true或false

2、nextInt(int bound):

随机返回0到bound之间的整数(不包括bound)

如:nextInt(10)返回0-9之间的随机数,nextInt(100)返回0-99之间的随机数

3、nextDouble():

返回(0, 1)开区间内的小数,精度为16位

4、nextFloat():

返回(0, 1)开区间内的小数,精度为8位

5、应用:

原文地址:https://www.cnblogs.com/javafucker/p/8582044.html