Class RandomDistribution.Binomial

java.lang.Object
org.apache.hadoop.hbase.util.RandomDistribution.Binomial
All Implemented Interfaces:
RandomDistribution.DiscreteRNG
Enclosing class:
RandomDistribution

public static final class RandomDistribution.Binomial extends Object implements RandomDistribution.DiscreteRNG
Binomial distribution. P(k)=select(n, k)*p^k*(1-p)^(n-k) (k = 0, 1, ..., n) P(k)=select(max-min-1, k-min)*p^(k-min)*(1-p)^(k-min)*(1-p)^(max-k-1)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
    private final int
     
    private final Random
     
    private final double[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Binomial(Random random, int min, int max, double p)
    Generate random integers from min (inclusive) to max (exclusive) following Binomial distribution.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the next random number
    private static double
    power(double p, int k)
     
    private static double
    select(int n, int k)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • random

      private final Random random
    • min

      private final int min
    • n

      private final int n
    • v

      private final double[] v
  • Constructor Details

    • Binomial

      public Binomial(Random random, int min, int max, double p)
      Generate random integers from min (inclusive) to max (exclusive) following Binomial distribution. The basic random number generator. Minimum integer maximum integer (exclusive). parameter.
  • Method Details