介绍
java.util.random.RandomGenerator
public interface RandomGenerator
java.util.Random
的父接口
API
static
- of
- getDefault
public
-
isDeprecated
- 是否废弃
-
doubles
- DoubleStream doubles()
- 无限流
- [0,1)
- DoubleStream doubles(double randomNumberOrigin, double randomNumberBound)
- 无限流
- [randomNumberOrigin, randomNumberBound)
- DoubleStream doubles(long streamSize)
- 有限流
- [0,1)
- DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)
- 有限流
- [randomNumberOrigin, randomNumberBound)
- DoubleStream doubles()
-
ints
- 无限流
- 默认 [Integer.MIN_VALUE, Integer.MAX_VALUE]
- 有类似
doubles
的四种重载
-
longs
- 无限流
- 默认 [Long.MIN_VALUE, Long.MAX_VALUE]
- 有类似
doubles
的四种重载
-
nextBoolean
-
nextBytes
void nextBytes(byte[] bytes)
- 为入参 bytes 赋值
-
nextFloat
float nextFloat()
- [0, 1)
float nextFloat(float bound)
- [0, bound)
float nextFloat(float origin, float bound)
- [origin, bound)
-
nextDouble
- 有类似
nextFloat
的三种重载
- 有类似
-
nextInt
- 有类似
nextFloat
的三种重载 - 无参时 [Integer.MIN_VALUE, Integer.MAX_VALUE]
- 有类似
-
nextLong
- 有类似
nextFloat
的三种重载 - 无参时 [Long.MIN_VALUE, Long.MAX_VALUE]
- 有类似
-
nextGaussian
- 高斯(正太)分布
-
nextExponential
- 指数分布