Class RandDistribution<T>

java.lang.Object
com.github.clevernucleus.dataattributes.api.util.RandDistribution<T>
Type Parameters:
T - Input type.

public final class RandDistribution<T> extends Object
Specialised object that takes in a type and works out weighted distributions.
  • Constructor Details

    • RandDistribution

      public RandDistribution(T fallback)
      Constructor.
      Parameters:
      fallback - Default value that is returned in case something fails.
  • Method Details

    • add

      public void add(T object, float weight)
      Adds to the internal inventory of the distributor.
      Parameters:
      object - Input object type.
      weight - Input object type's weight.
    • getDistributedRandom

      public T getDistributedRandom()
      Returns:
      A randomly distributed and weighted result.