Class WeightedRandomPicker<T>

java.lang.Object
com.fs.starfarer.api.util.WeightedRandomPicker<T>
All Implemented Interfaces:
Cloneable

public class WeightedRandomPicker<T> extends Object implements Cloneable
  • Constructor Details

    • WeightedRandomPicker

      public WeightedRandomPicker()
    • WeightedRandomPicker

      public WeightedRandomPicker(boolean ignoreWeights)
    • WeightedRandomPicker

      public WeightedRandomPicker(Random random)
  • Method Details

    • clone

      public WeightedRandomPicker<T> clone()
      Overrides:
      clone in class Object
    • clear

      public void clear()
    • addAll

      public void addAll(Collection<T> items)
    • addAll

      public void addAll(WeightedRandomPicker<T> other)
    • add

      public void add(T item)
    • add

      public void add(T item, float weight)
    • remove

      public void remove(T item)
    • isEmpty

      public boolean isEmpty()
    • getItems

      public List<T> getItems()
    • getWeight

      public float getWeight(T item)
    • getWeight

      public float getWeight(int index)
    • setWeight

      public void setWeight(int index, float weight)
    • getItemWithHighestWeight

      public T getItemWithHighestWeight()
    • pickAndRemove

      public T pickAndRemove()
    • pick

      public T pick(Random random)
    • pick

      public T pick()
    • getRandom

      public Random getRandom()
    • setRandom

      public void setRandom(Random random)
    • print

      public void print(String title)
    • getTotal

      public float getTotal()