类 RandomAdaptor
java.lang.Object
java.util.Random
org.hipparchus.random.RandomAdaptor
- 所有已实现的接口:
-
Serializable
,RandomGenerator
,RandomGenerator
Extension of
Random
wrapping a RandomGenerator
.
- 另请参阅:
-
嵌套类概要
-
构造器概要
构造器说明RandomAdaptor
(RandomGenerator randomGenerator) Construct a RandomAdaptor wrapping the supplied RandomGenerator. -
方法概要
修饰符和类型方法说明boolean
Returns the next pseudorandom, uniformly distributedboolean
value from this random number generator's sequence.void
nextBytes
(byte[] bytes) Generates random bytes and places them into a user-supplied byte array.void
nextBytes
(byte[] bytes, int offset, int len) Generates random bytes and places them into a user-supplied byte array.double
Returns the next pseudorandom, uniformly distributeddouble
value between0.0
and1.0
from this random number generator's sequence.float
Returns the next pseudorandom, uniformly distributedfloat
value between0.0
and1.0
from this random number generator's sequence.double
Returns the next pseudorandom, Gaussian ("normally") distributeddouble
value with mean0.0
and standard deviation1.0
from this random number generator's sequence.int
nextInt()
Returns the next pseudorandom, uniformly distributedint
value from this random number generator's sequence.int
nextInt
(int n) Returns a pseudorandom, uniformly distributedint
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.long
nextLong()
Returns the next pseudorandom, uniformly distributedlong
value from this random number generator's sequence.long
nextLong
(long n) Returns a pseudorandom, uniformly distributedint
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.static Random
of
(RandomGenerator randomGenerator) Factory method to create aRandom
using the suppliedRandomGenerator
.void
setSeed
(int seed) Sets the seed of the underlying random number generator using anint
seed.void
setSeed
(int[] seed) Sets the seed of the underlying random number generator using anint
array seed.void
setSeed
(long seed) Sets the seed of the underlying random number generator using along
seed.从类继承的方法 java.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, next
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 java.util.random.RandomGenerator
isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong
-
构造器详细资料
-
RandomAdaptor
Construct a RandomAdaptor wrapping the supplied RandomGenerator.- 参数:
-
randomGenerator
- the wrapped generator - 抛出:
-
NullArgumentException
- if randomGenerator is null
-
-
方法详细资料
-
of
Factory method to create aRandom
using the suppliedRandomGenerator
.- 参数:
-
randomGenerator
- wrapped RandomGenerator instance - 返回:
- a Random instance wrapping the RandomGenerator
-
nextBoolean
public boolean nextBoolean()Returns the next pseudorandom, uniformly distributedboolean
value from this random number generator's sequence.- 指定者:
-
nextBoolean
在接口中RandomGenerator
- 指定者:
-
nextBoolean
在接口中RandomGenerator
- 覆盖:
-
nextBoolean
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、均匀分布的
boolean
值
-
nextBytes
public void nextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array. The number of random bytes produced is equal to the length of the byte array.- 指定者:
-
nextBytes
在接口中RandomGenerator
- 指定者:
-
nextBytes
在接口中RandomGenerator
- 覆盖:
-
nextBytes
在类中Random
- 参数:
-
bytes
- 非空字节数组,用于存放随机字节
-
nextBytes
public void nextBytes(byte[] bytes, int offset, int len) Generates random bytes and places them into a user-supplied byte array.- 指定者:
-
nextBytes
在接口中RandomGenerator
- 参数:
-
bytes
- 非空字节数组,用于存放随机字节 -
offset
- 插入生成字节到数组中的起始索引 -
len
- 要生成的字节数
-
nextDouble
public double nextDouble()Returns the next pseudorandom, uniformly distributeddouble
value between0.0
and1.0
from this random number generator's sequence.- 指定者:
-
nextDouble
在接口中RandomGenerator
- 指定者:
-
nextDouble
在接口中RandomGenerator
- 覆盖:
-
nextDouble
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、均匀分布的
double
值,介于0.0
和1.0
之间
-
nextFloat
public float nextFloat()Returns the next pseudorandom, uniformly distributedfloat
value between0.0
and1.0
from this random number generator's sequence.- 指定者:
-
nextFloat
在接口中RandomGenerator
- 指定者:
-
nextFloat
在接口中RandomGenerator
- 覆盖:
-
nextFloat
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、均匀分布的
float
值,范围在0.0
和1.0
之间
-
nextGaussian
public double nextGaussian()返回下一个伪随机、高斯("正态")分布的double
值,均值为0.0
,标准偏差为1.0
,来自此随机数生成器的序列。- 指定者:
-
nextGaussian
在接口中RandomGenerator
- 指定者:
-
nextGaussian
在接口中RandomGenerator
- 覆盖:
-
nextGaussian
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、高斯("正态")分布的
double
值,均值为0.0
,标准偏差为1.0
-
nextInt
public int nextInt()返回从此随机数生成器的序列中下一个伪随机、均匀分布的int
值。所有232个可能的int
值应以(大约)相等的概率产生。- 指定者:
-
nextInt
在接口中RandomGenerator
- 指定者:
-
nextInt
在接口中RandomGenerator
- 覆盖:
-
nextInt
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、均匀分布的
int
值
-
nextInt
public int nextInt(int n) 返回一个伪随机、均匀分布的int
值,范围在0(包含)和指定值(不包含)之间,来自此随机数生成器的序列。- 指定者:
-
nextInt
在接口中RandomGenerator
- 指定者:
-
nextInt
在接口中RandomGenerator
- 覆盖:
-
nextInt
在类中Random
- 参数:
-
n
- 要返回的随机数的上限。必须为正数。 - 返回:
-
一个伪随机、均匀分布的
int
值,范围在0(包含)和n(不包含)之间 - 抛出:
-
IllegalArgumentException
- 如果n不是正数。
-
nextLong
public long nextLong()返回从此随机数生成器的序列中下一个伪随机、均匀分布的long
值。所有264个可能的long
值应以(大约)相等的概率产生。- 指定者:
-
nextLong
在接口中RandomGenerator
- 指定者:
-
nextLong
在接口中RandomGenerator
- 覆盖:
-
nextLong
在类中Random
- 返回:
-
从此随机数生成器的序列中返回下一个伪随机、均匀分布的
long
值
-
nextLong
public long nextLong(long n) 返回一个伪随机、均匀分布的int
值,范围在0(包含)和指定值(不包含)之间,来自此随机数生成器的序列。- 指定者:
-
nextLong
在接口中RandomGenerator
- 指定者:
-
nextLong
在接口中RandomGenerator
- 参数:
-
n
- 要返回的随机数的上限。必须为正数。 - 返回:
-
一个伪随机、均匀分布的
int
值,范围在0(包含)和n(不包含)之间
-
setSeed
public void setSeed(int seed) 使用int
种子设置基础随机数生成器的种子。从相同种子开始生成的值序列应该是相同的。
- 指定者:
-
setSeed
在接口中RandomGenerator
- 参数:
-
seed
- 种子值
-
setSeed
public void setSeed(int[] seed) 使用int
数组种子设置基础随机数生成器的种子。从相同种子开始生成的值序列应该是相同的。
- 指定者:
-
setSeed
在接口中RandomGenerator
- 参数:
-
seed
- 种子值
-
setSeed
public void setSeed(long seed) 使用long
种子设置基础随机数生成器的种子。从相同种子开始生成的值序列应该是相同的。
- 指定者:
-
setSeed
在接口中RandomGenerator
- 覆盖:
-
setSeed
在类中Random
- 参数:
-
seed
- 种子值
-