package me.xdrop.jrand;

import me.xdrop.jrand.random.Rand;

import java.util.*;

public abstract class Generator<T> {

    private Rand randGen;

    public Generator() {
        this.randGen = new Rand();
    }

    public Rand random() {
        return this.randGen;
    }

    public abstract T gen();

    public String genString() {
        return gen().toString();
    }

    public List<T> genMany(int num) {
        List<T> many = new ArrayList<>();
        for (int n = 0; n < num; n++) {
            many.add(gen());
        }
        return many;
    }

    public List<T> genManyUnique(int num) {
        List<T> many = new LinkedList<>();
        Set<T> present = new HashSet<>();


        for (int n = 0; n < num; n++) {
            T gen;
            do {
                gen = gen();
            } while (present.contains(gen));
            many.add(gen);
            present.add(gen);
        }

        return many;
    }

    public Set<T> genManyAsSet(int num) {
        List<T> many = new LinkedList<>();
        for (int n = 0; n < num; n++) {
            many.add(gen());
        }
        return new HashSet<>(many);
    }

}

@@ -300,16 +300,209 @@
 gen();%0A%0A
+    public String repeat(int times) %7B%0A        StringBuilder sb = new StringBuilder();%0A        while (times-- %3E 0) %7B%0A            sb.append(gen());%0A        %7D%0A        return sb.toString();%0A    %7D%0A%0A
     publ

Add repeat option