类 RandomAdaptor

java.lang.Object
java.util.Random
org.hipparchus.random.RandomAdaptor
所有已实现的接口:
Serializable, RandomGenerator, RandomGenerator

public class RandomAdaptor extends Random implements RandomGenerator
Extension of Random wrapping a RandomGenerator.
另请参阅:
  • 构造器详细资料

    • RandomAdaptor

      public RandomAdaptor(RandomGenerator randomGenerator)
      Construct a RandomAdaptor wrapping the supplied RandomGenerator.
      参数:
      randomGenerator - the wrapped generator
      抛出:
      NullArgumentException - if randomGenerator is null
  • 方法详细资料

    • of

      public static Random of(RandomGenerator randomGenerator)
      Factory method to create a Random using the supplied RandomGenerator.
      参数:
      randomGenerator - wrapped RandomGenerator instance
      返回:
      a Random instance wrapping the RandomGenerator
    • nextBoolean

      public boolean nextBoolean()
      Returns the next pseudorandom, uniformly distributed boolean 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 distributed double value between 0.0 and 1.0 from this random number generator's sequence.
      指定者:
      nextDouble 在接口中 RandomGenerator
      指定者:
      nextDouble 在接口中 RandomGenerator
      覆盖:
      nextDouble 在类中 Random
      返回:
      从此随机数生成器的序列中返回下一个伪随机、均匀分布的double值,介于0.01.0之间
    • nextFloat

      public float nextFloat()
      Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.
      指定者:
      nextFloat 在接口中 RandomGenerator
      指定者:
      nextFloat 在接口中 RandomGenerator
      覆盖:
      nextFloat 在类中 Random
      返回:
      从此随机数生成器的序列中返回下一个伪随机、均匀分布的float值,范围在0.01.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 - 种子值