All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dennisit.vplus.data.utils.FissionUtils Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
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());
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy