package org.ntlab.radishforandroidstudio.cactusClient.models;

import java.util.Set;

import org.apache.commons.lang3.RandomStringUtils;

public class RandomStringGenerator {
    public static final String ALPHA_NUMERIC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    private RandomStringGenerator() {

    }

    static public String generateRandomString(int num, String seed) {
        return RandomStringUtils.random(num, seed);
    }

    static public boolean checkString(String str, Set<String> set) {
        return set.contains(str);
    }

    static public String generateUniqueString(int num, String seed, Set<String> set) {
        String str;
        do {
            str = generateRandomString(num, seed);
        } while (checkString(str, set));
        return str;
    }
}