package de.oaa.xxx.games.chastity.common;

import java.util.Random;

public class CodeCreator {

	private static final String CHARS_AN = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789";
	private static final String CHARS_N = "0123456789";
	
	public static String createNumeric(int digits) {
		return create(digits, CHARS_N);
	}
	
	public static String createAlphanumeric(int digits) {
		return create(digits, CHARS_AN);
	}
	
	private static String create(int digits, String chars) {
		StringBuilder sb = new StringBuilder(6);
		for (int i = 0; i < digits; i++) {
			sb.append(chars.charAt(new Random().nextInt(chars.length())));
		}
		return sb.toString();
	}
}
