类 AliasMethod


  • public final class AliasMethod
    extends java.lang.Object
    detail: 随机概率采样算法
    作者:
    Keith Schwarz
    另请参阅:
    ,
    • 构造器概要

      构造器 
      构造器 说明
      AliasMethod​(java.util.List<java.lang.Double> probabilities)
      Constructs a new AliasMethod to sample from a discrete distribution and hand back outcomes based on the probability distribution.
      AliasMethod​(java.util.List<java.lang.Double> probabilities, java.util.Random random)
      Constructs a new AliasMethod to sample from a discrete distribution and hand back outcomes based on the probability distribution.
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      int next()
      获取随机索引 ( 对应几率索引 ) Samples a value from the underlying distribution.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • AliasMethod

        public AliasMethod​(java.util.List<java.lang.Double> probabilities)
        Constructs a new AliasMethod to sample from a discrete distribution and hand back outcomes based on the probability distribution.

        Given as input a list of probabilities corresponding to outcomes 0, 1, ..., n - 1, this constructor creates the probability and alias tables needed to efficiently sample from this distribution.

        参数:
        probabilities - The list of probabilities.
      • AliasMethod

        public AliasMethod​(java.util.List<java.lang.Double> probabilities,
                           java.util.Random random)
        Constructs a new AliasMethod to sample from a discrete distribution and hand back outcomes based on the probability distribution.

        Given as input a list of probabilities corresponding to outcomes 0, 1, ..., n - 1, along with the random number generator that should be used as the underlying generator, this constructor creates the probability and alias tables needed to efficiently sample from this distribution.

        参数:
        probabilities - The list of probabilities.
        random - The random number generator
    • 方法详细资料

      • next

        public int next()
        获取随机索引 ( 对应几率索引 ) Samples a value from the underlying distribution.
        返回:
        A random value sampled from the underlying distribution.