Class RandomCollection<T>

java.lang.Object
com.fastasyncworldedit.core.util.collection.RandomCollection<T>
Type Parameters:
T - the type of values the collection holds.
Direct Known Subclasses:
FastRandomCollection, SimpleRandomCollection

public abstract class RandomCollection<T> extends Object
A RandomCollection holds multiple values that can be accessed by using next(int, int, int). The returned value is determined by a given SimpleRandom implementation.
  • Constructor Details

    • RandomCollection

      protected RandomCollection(SimpleRandom random)
  • Method Details

    • of

      public static <T> RandomCollection<T> of(Map<T,Double> weights, SimpleRandom random)
      Return a new RandomCollection. The implementation may differ depending on the given arguments but there is no need to differ.
      Type Parameters:
      T - the type the collection holds.
      Parameters:
      weights - the weighted map.
      random - the random number generator.
      Returns:
      a RandomCollection using the given weights and the RNG.
    • setRandom

      public void setRandom(SimpleRandom random)
    • getRandom

      public SimpleRandom getRandom()
    • next

      public abstract T next(int x, int y, int z)