Class ChanceTable<T>

java.lang.Object
org.spongepowered.api.util.weighted.RandomObjectTable<T>
org.spongepowered.api.util.weighted.ChanceTable<T>
Type Parameters:
T - The entry type
All Implemented Interfaces:
Iterable<TableEntry<T>>, Collection<TableEntry<T>>

public class ChanceTable<T> extends RandomObjectTable<T>
This is a variant of the RandomObjectTable which uses a 0-1 chance attached to every entry. When rolled the a chance roll is calculated for each entry and all entries which pass are returned.
  • Constructor Details

    • ChanceTable

      public ChanceTable()
      Creates a new ChanceTable with a default roll count of 1.
    • ChanceTable

      public ChanceTable(int rolls)
      Creates a new ChanceTable.
      Parameters:
      rolls - The number of rolls to perform
  • Method Details