com.github.dennisit.vplus.data.utils.FissionUtils Maven / Gradle / Ivy
package com.github.dennisit.vplus.data.utils;
import java.util.concurrent.ThreadLocalRandom;
public class FissionUtils {
private static final ThreadLocalRandom random = ThreadLocalRandom.current();
// 64L
public static final String BASE_CHAR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-";
private static char random() {
return BASE_CHAR.charAt(random.nextInt(0, BASE_CHAR.length()));
}
public static String code() {
return code(6);
}
public static String code(int length) {
StringBuffer buffer = new StringBuffer();
for (int i = 1; i <= length; i++) {
buffer.append(random());
}
return buffer.toString();
}
public static void main(String[] args) {
System.out.println(64 * 64 * 64 * 64 * 64L * 64L);
for (int i = 0; i < 100; i++) {
System.out.println(code());
}
}
}