Class WeightedRandom<E extends WeightedRandomItem>

java.lang.Object
net.minestom.server.utils.WeightedRandom<E>
Type Parameters:
E -

public class WeightedRandom<E extends WeightedRandomItem>
extends java.lang.Object
Produces a random element from a given set, with weights applied.
  • Constructor Summary

    Constructors 
    Constructor Description
    WeightedRandom​(java.util.Collection<E> items)  
  • Method Summary

    Modifier and Type Method Description
    E get​(java.util.Random rng)
    Gets a random element from this set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • get

      public E get​(java.util.Random rng)
      Gets a random element from this set.
      Parameters:
      rng - Random Number Generator to generate random numbers with
      Returns:
      a random element from this set