类 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. -
方法概要
修饰符和类型方法说明booleanReturns the next pseudorandom, uniformly distributedbooleanvalue from this random number generator's sequence.voidnextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array.voidnextBytes(byte[] bytes, int offset, int len) Generates random bytes and places them into a user-supplied byte array.doubleReturns the next pseudorandom, uniformly distributeddoublevalue between0.0and1.0from this random number generator's sequence.floatReturns the next pseudorandom, uniformly distributedfloatvalue between0.0and1.0from this random number generator's sequence.doubleReturns the next pseudorandom, Gaussian ("normally") distributeddoublevalue with mean0.0and standard deviation1.0from this random number generator's sequence.intnextInt()Returns the next pseudorandom, uniformly distributedintvalue from this random number generator's sequence.intnextInt(int n) Returns a pseudorandom, uniformly distributedintvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.longnextLong()Returns the next pseudorandom, uniformly distributedlongvalue from this random number generator's sequence.longnextLong(long n) Returns a pseudorandom, uniformly distributedintvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.static Randomof(RandomGenerator randomGenerator) Factory method to create aRandomusing the suppliedRandomGenerator.voidsetSeed(int seed) Sets the seed of the underlying random number generator using anintseed.voidsetSeed(int[] seed) Sets the seed of the underlying random number generator using anintarray seed.voidsetSeed(long seed) Sets the seed of the underlying random number generator using alongseed.从类继承的方法 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 aRandomusing the suppliedRandomGenerator.- 参数:
-
randomGenerator- wrapped RandomGenerator instance - 返回:
- a Random instance wrapping the RandomGenerator
-
nextBoolean
public boolean nextBoolean()Returns the next pseudorandom, uniformly distributedbooleanvalue 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 distributeddoublevalue between0.0and1.0from 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 distributedfloatvalue between0.0and1.0from 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- 种子值
-