public static Generator anyOf()

in src/main/java/org/jetbrains/jetCheck/Generator.java [132:139]


  public static <T> Generator<T> anyOf(List<? extends Generator<? extends T>> alternatives) {
    if (alternatives.isEmpty()) throw new IllegalArgumentException("No alternatives to choose from");
    return from(data -> {
      ((AbstractDataStructure) data).changeKind(StructureKind.CHOICE);
      int index = ((AbstractDataStructure)data).drawInt(IntDistribution.uniform(0, alternatives.size() - 1));
      return data.generate(alternatives.get(index));
    });
  }