Type Parameters:
E - the type of element in the set

public class RandomSampleSet<E>
extends Object
A helper class to randomly sample elements from an initial set.
  • Field Details

    • rand

      private final Random rand
    • list

      private final List<E> list
      To this list no elements are added and it is initialized by a set. Thus we can make sure, that the list contains no two same elements.
    • listSize

      private double listSize
  • Constructor Details

    • RandomSampleSet

      public RandomSampleSet​(Set<E> set)
    • RandomSampleSet

      public RandomSampleSet​(Set<E> set, Random rand)
    • RandomSampleSet

      public RandomSampleSet​(Set<E> set, long seed)
  • Method Details

    • getRandomElement

      public E getRandomElement()
    • getRandomElement

      public E getRandomElement​(Set<E> exclude)
    • getRandomElementsWithRepetition

      public List<E> getRandomElementsWithRepetition​(int countOfElements)
    • getRandomElementsWithRepetition

      public List<E> getRandomElementsWithRepetition​(int countOfElements, Set<E> exclude)
    • getRandomElementsWithoutRepetition

      public List<E> getRandomElementsWithoutRepetition​(int countOfElements)
    • getRandomElementsWithoutRepetition

      public List<E> getRandomElementsWithoutRepetition​(int countOfElements, Set<E> exclude)