Class ParabolicDistributionNearbyRandom

  • All Implemented Interfaces:

    public class ParabolicDistributionNearbyRandom
    extends Object
    implements NearbyRandom
    P(x) = 3(m - x)²/m³.

    Cumulative probability: F(x) = 1 - (1 - x/m)³.

    Inverse cumulative probability: F(p) = m(1 - (1 - p)^(1/3)).

    • Field Detail

      • sizeMaximum

        protected final int sizeMaximum
    • Constructor Detail

      • ParabolicDistributionNearbyRandom

        public ParabolicDistributionNearbyRandom​(int sizeMaximum)
    • Method Detail

      • nextInt

        public int nextInt​(Random random,
                           int nearbySize)
        Specified by:
        nextInt in interface NearbyRandom
        random - never null
        nearbySize - never negative. The number of available values to select from. Normally this is the size of the value range for a non-chained variable and the size of the value range (= size of the entity list) minus 1 for a chained variable.
        0 <= x < nearbySize